I've been looking on the internet for a long time but couldn't figure out how to make it. I need to draw several figures whose xticks are defined as numpy.arange(1,N), N being different for each figure. I want the spacing between the xticks to be identical on all figures (e.g. 1 cm), that is, the width of each figure must depend on the size of numpy.arange(1,N). Any idea of how to do that?
I think you can do this with a combination of careful control of your axes size (as a fraction of the figure), ax.set_xlim
and fig.set_size_inches
(doc) to set the real size of the figure.
ex
fig = plt.figure()
ax = fig.add_axes([0,0,1,1])
ax.set_xlim([0,N])
fig.set_size_inches([N/2.54,h])
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