Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

add_axes shows deprecation warning when called with onlykwargs #17114

Closed
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Milestone
@brunobeltran

Description

@brunobeltran

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp