Reputation: 1335
Is there a command to set the length of an axis? I do not mean the range! Independently from the values, the range from the axis or other factors, I want to set its length. How can I do that?
Something like plt.yaxislenght(20)
?
Upvotes: 1
Views: 2323
Reputation: 87356
What you want to do is tricky due to the way that mpl works underneath. Most of the artist are specified in units that are not on-screen units (data, axes, or figure space: see transfrom tutorial). This gives you a good deal of power/flexibility as most of the time you want to work in one of the relative sets of coordinates, however the cost is if you want to set 'absolute' sizes of things you end up having to do it indirectly.
If you want you axis to be a fixed length (in display units) between figures, then you need to control the size of you axes (in figure units) by hand (via fig.add_axes
) and then use fig.set_size_inches
to set the size of your over-all figure. By tweaking these values you can get what you want.
Upvotes: 1
Reputation: 1039
I'm not sure of a specific way to set an axis length of axes generated by e.g. plt.subplots
. You can use ax.set_aspect(num)
, but this adjusts the aspect ratio, and therefore will change both axes in a dependent way.
You can however use ax = plt.axes([left,bottom,width,height])
to add individual subplots in whatever positions you like. This should allow you to achieve what you want, but will be tedious because you need to place each subplot manually.
Upvotes: 2