Matplotlib savefig does not save axes

Could be facecolor. I work in jupyter lab, and the facecolor default is set to black, so you don't see the axes, even though they are being drawn.

fig = plt.figure(facecolor=(1, 1, 1))

sets the background color to white.


Defining fig = plt.figure(figsize=(15,10)) at the beginning, saving the file as .jpg and setting bbox_inches='tight' - plt.savefig('filename.jpg',bbox_inches='tight', dpi=150) solved the issue for me. bbox_inches='tight' seems to fix cropping issues but it didn't work for .png.

Tags:

Matplotlib