Pages

Matpotlib error: Image size of 3831x7771797 pixels is too large. It must be less than 2^16 in each direction.

This is due to the large file size of the figs. you have plotted.
If you get this error, you may not visualize the figure(s) on the matplotlib.
However, you can save as a file (.pdf or .eps ir .png) and you can open and see the figures.

If you want to elimate the error message, the only solution is to decrease the file size (you may decrease the size of the figure or the pixel size)

Here is a related post in GitHub.
https://github.com/matplotlib/matplotlib/issues/16234


Another reason you may get this error may be due to the following reason.

If you have plt.text option as follow,

plt.text(6.0, 7.4, '(b)', ha='center', va='center', fontsize=14, rotation='horizontal', fontweight='bold')

then, this may be causing the problem (especially if you use alreadying existing script to plot figs.)
To solve this problem, just comment this plt.text() using # and try to save the file.
Now, if there is no error, you just adjust the location of the text values in the plt.text() to proper place.

This would solve this error.



No comments:

Post a Comment

You may be interested in these posts

Error in image file conversion: convert-im6.q16: not authorized `test.eps' @ error/constitute.c/WriteImage/1037.

This error is because of the vulnerability. This allows remote execution of code using image formats. So, some Linux distributions by defaul...