You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add an axes to the current figure and make it the current axes.
Call signatures::
plt.axes()
plt.axes(rect, projection=None, polar=False, **kwargs)
plt.axes(ax)
Parameters
----------
arg : None or 4-tuple
The exact behavior of this function depends on the type:
- *None*: A new full window axes is added using
``subplot(**kwargs)``.
- 4-tuple of floats *rect* = ``[left, bottom, width, height]``.
A new axes is added with dimensions *rect* in normalized
(0, 1) units using `~.Figure.add_axes` on the current figure.
...
The mpl.axes.Axes constructor accepts a position parameter and so it shows it up in list of additional keyword arguments, but it's overridden by the handling of arg=None in this interface function.
All you need to do is change your code to plt.axes(pos), etc.
plt.axes() should probably at least warn that it's ignoring position= in this case.
The changed in 261f706#18564 While I agree that one need not pass position=rect, I guess we shouldn't have broken this, and we should definitely not document this as something that is possible.
Activity
ramzim commentedon Oct 23, 2021
Tried updating to 3.4.3 and got the same plotting result.
[-][Bug]: [/-][+][Bug]: axes(position = [...]) behavior[/+]mwaskom commentedon Oct 23, 2021
The docstring for
plt.axesreads:The
mpl.axes.Axesconstructor accepts apositionparameter and so it shows it up in list of additional keyword arguments, but it's overridden by the handling ofarg=Nonein this interface function.All you need to do is change your code to
plt.axes(pos), etc.plt.axes()should probably at least warn that it's ignoringposition=in this case.ramzim commentedon Oct 23, 2021
Thank you. Is this a change in behavior? Writing the code as I had it above in Google Colab gives the behavior I had expected.
jklymak commentedon Oct 23, 2021
It's definitely a change. Whether it was on purpose or not I'm not quite sure.
mwaskom commentedon Oct 23, 2021
The default version on Colab is older (3.2.2) and does indeed work differently, but the documentation for the parameters is the same.
jklymak commentedon Oct 23, 2021
The changed in 261f706 #18564 While I agree that one need not pass
position=rect, I guess we shouldn't have broken this, and we should definitely not document this as something that is possible.