Increasing space for X axis labels in Matplotlib

I draw, but I find that I need to enlarge the area under the chart so that I can draw labels vertically, but in a font size that is not so tiny. At the moment I have:

plt.figure(count_fig) fig, ax = plt.subplots() 
rects1 = ax.bar(ind, ratio_lst, width, color='r', linewidth=1, alpha=0.8, log=1) 
ax.set_ylabel('') 
ax.set_title('') 
ax.set_xticks(ind_width) 
ax.set_xticklabels(labels_lst, rotation='vertical', fontsize=6)

This currently works, but labels often reset the edge of the graph.

+4
source share
1 answer

subplots_adjustwill do it. You can play with the keyword bottomto get a good arrangement of the bottom of the plot.

fig.subplots_adjust(bottom=0.2)
+5
source

All Articles