UNagaswamy
UNagaswamy

Reputation: 2150

Import png files and save as subplots using matplotlib

I would like to import two png files and stich them into subplots using matplotlib. I am following this tutorial to do this. But when I save the figure with a 2x2 subplot, the resolution is very poor. Is there a better way of doing this?

Upvotes: 0

Views: 2419

Answers (1)

Matthew Turner
Matthew Turner

Reputation: 3740

If the resolution is satisfactory before you save, try using the dpi keyword along with matplotlib.pyplot.savefig() (see docs page for matplotlib.pyplot.savefig). Once you have the plot generated, simply type

from matplotlib.pyplot import savefig
savefig( 'stitched.png', dpi=400 )

and hopefully this results in a satisfactory png.

Upvotes: 2

Related Questions