Very simple and stupid question, which I could not find answer for; when I do manual axis positioning, like so:
fig = plt.figure(figsize=(17.5,8.0))
left = 0.1
bottom = 0.03
width = 0.3
height = 0.6
ax1 = plt.axes([left, bottom, width, height])
left += (width+0.12)
ax2 = plt.axes([left, bottom, width, height])
these left, bottom, width, height
variables are set in the units relative to the figure size, but which corresponds to which: is left
and width
~ horizontal fig_size
while bottom
and height
~ vertical fig_size
? My experimenting with this disproves this, and it is not clear at all, as it seems to depend on the vertical and horizontal components of the figsize
... Shouldn't i say that matplotlib
documentation is very unclear about it as well (neither plt.axes
, nor fig.add_axes
provide any useful info). So, please help?!
EDIT: I'll post my findings here, as maybe it would be helpful for others too...
First of all, it seems now, that I was correct in the first place (as answers and comments confirm) and indeed left
and width
is measured in horizontal-fig_size
units, while bottom
and height
is measured vertical-fig_size
units - and everything is exactly the way it is shown in the first answer.
However, it is context dependent(!), in case you're doing plt.imshow
downstream - this seems to overwrite width
, height
ratio and create square axes (for my data, as I have n
by n
matrix) with the size of min(width, height)
. I didn't know about this behavior of the imshow
.
Examples:
left = 0.1 bottom = 0.03 width = 0.3 height = 0.3
with imshow
:
left = 0.1 bottom = 0.03 width = 0.3 height = 0.3
without imshow
or any other content:
So the
imshow
was the source of the confusion and the "disproval".