Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug report
Bug summary
Callingadd_axes
without args is deprecated. However, if a kwarg is passed, the deprecation warning still shows.
Code for reproduction
importmatplotlib.pyplotaspltfig=plt.figure()ax=fig.add_axes(rect=[0,0,1,1])
Actual outcome
<ipython-input-128-1ef4234f1c1f>:3: MatplotlibDeprecationWarning: Calling add_axes() without argument is deprecated. You may want to use add_subplot() instead. ax = fig.add_axes(rect=[0, 0, 1, 1])
Expected outcome
No warning should be shown.
Discussion
figure.add_axes
currently starts with
if not len(args): cbook.warn_deprecated( "3.3", message="Calling add_axes() without argument is " "deprecated. You may want to use add_subplot() " "instead.") return
Because the function forwardskwargs
, the intended behavior is a bit ambiguous to me, but I'm assuming from the docstring that the intention is to force the user to passrect
specifically?
if not len(args) and 'rect' not in kwargs: ...
I can make this a PR if necessary, but if I'm not sure if we continue to update 3.2...And I don't know what the deprecation schedule even looks like for removing the "ability to use no args", so I don't know if this will even be an issue after 3.3....just wanted to point it out.
Feel free to close if this is a non-issue.