0

I need to save a graph with high resolution by:

plt.savefig('trace', format='jpeg', bbox_inches='tight', dpi=3000)

The main graph is: enter image description here

But it saves partially, like this: enter image description here

How can I solve this problem?

Nasrin
  • 13
  • 5
  • Can you give us a reproducible example where this happens? For instance we don't know how big the original figure is. In general Matplotlib is limited to 2**16 = 65,536 pixels in each direction so if your figure is more than 21.8 inches long it will have problems. (though if that were the problem I'm surprised is saved anything at all) – Jody Klymak Aug 18 '22 at 17:13
  • Here the main image is just a screen shot because I couldn't save it. But the one that has been saved partially is 11.6 Mb. Also, I have used: ` f = plt.figure() f.set_figwidth(14) f.set_figheight(4) ` for the dimensions. – Nasrin Aug 19 '22 at 06:37
  • My guess is you are hitting some sort of limit in the underlying libraries and will have to reduce the dpi or make the figure smaller. – Jody Klymak Aug 19 '22 at 17:30
  • Yes, thanks. I made the figure smaller but with the same dpi. Now, it works. – Nasrin Aug 21 '22 at 08:14

0 Answers0