In one of my data pipelines, I didn’t want any GUI pop-ups. So I skipped plt.show()
entirely and just used plt.savefig('output_chart.png')
.
That’s the cleanest way to matplotlib
save figure silently, especially when running on servers or CI where no display is available.