Here's my code:
fig = plt.figure()
plt.figure(figsize=(15, 6))
plt.bar(x_labels, y_labels, width=0.9)
plt.xticks(rotation=90)
This yields this graph: 
As you can see, the bottoms of the labels keep getting cut off. I know one solution is to use plt.savefig('rest.png', bbox_inches='tight') but how do I fit it all without using that argument in savefig()? How can I achieve that effect of bbox_inches='tight' without using plt.savefig()? What else can be done to fit it all? 
try giving the x-axis a little bit of a buffer
fig.subplots_adjust(bottom=0.6)
The line that worked for me while I was working on long tick marks was:
plt.tight_layout()
plt.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With