1

I'm trying to insert a plot into another one by using:

...
im = plt.imread(get_sample_data('Inset.eps', asfileobj=True),format='eps')
newax = f.add_axes([0.14, 0.30, 0.45, 0.40])
newax.imshow(im,interpolation='none')
newax.axis('off')
plt.savefig('FinalPlot.eps',format='eps',dpi=1000,bbox_inches='tight')

The problem is that everything in FinalPlot.eps has good resolution but the inset, it has a really poor quality. Do you know how to improve the quality of the inset?

Image example

  • Do you have access to the 'Inset.eps' data (and code)? Can you save it instead as, say a PNG of very high resolution and then do the same inclusion? I think matplotlib.pyplot.imread uses PIL to read in images, and the rasterization method might play a role (indeed: https://matplotlib.org/devdocs/api/_as_gen/matplotlib.pyplot.imread.html). Also, what happens when you save your figure in say .png format, with a high dpi, say 'dpi=150'? – Magnus Persson Jan 08 '18 at 12:56
  • Thank you Magnus, seems like it does not like .eps nor ps. I changed the format to .png and it is better now. – Gustavo Adolfo Cruz Diaz Jan 09 '18 at 00:28
  • OK, good. The only downside to this is a (in general) larger file size. – Magnus Persson Jan 09 '18 at 08:53

0 Answers0