Skip to content
Advertisement

x axis label cropped on saved image

So I’m trying to do a bar plot on a data where x is the username (string ) and each x is long enough to overlap each other, so I have to rotate the x label. No problem there. However, when exporting the plot results, the x label on the exported image is cropped. I tried using plt.tight_layout() and worked, but it change the look of the plot. The code is similar to this

JavaScript

Exported image:

wrong_image

I want it to look like this (Got this by using jupyter notebook and manually save output image):

correct_image

So how to do that?

Advertisement

Answer

You can play around with the rcParams size settings and the plt.subplots_adjust settings until you get your desired image.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement