Reputation: 527
How to set space for xlabels please? I read https://matplotlib.org/api/_as_gen/matplotlib.pyplot.xlabel.html but I don't understant. I use matplotlib.pyplot. Thank you
plt.xlabel(r'Měsíc', fontsize=12)
Upvotes: 1
Views: 80
Reputation: 10880
You could use plt.tight_layout()
it is used for exactly such problems. Additionally if its automatic algorithm to distribute everything nicely on the canvas, it as a kwarg rect
, which needs a list of [xmin, ymin, xmax, ymax]
values defining the space of the figure to be used for the (sub)plot(s), e.g.
plt.tight_layout(rect=[0, .1, 1, .95)
It should be called at the end of the plot creation, right before plt.show()
if your script needs the latter.
Upvotes: 2