Skip to content

Incorrect return type on matplotlib.pyplot.subplot_mosaic #238

@blakeNaccarato

Description

@blakeNaccarato

The return type is dict[Text, Axes]. Since this is the functional API, it returns a tuple of figure and axes dictionary, so it should be tuple[Figure, dict[Text, Axes]]. I can submit a PR on this, if you'd like. It's alright to use Figure as the return type, or should I annotate it with some other abstract superclass?

As it is now:

def subplot_mosaic(
mosaic: list | str,
*,
sharex: bool = ...,
sharey: bool = ...,
subplot_kw: dict = ...,
gridspec_kw: dict = ...,
empty_sentinel: object = ...,
**fig_kw
) -> dict[Text, Axes]: ...

With correction:

def subplot_mosaic(
    ...
) -> tuple[Figure, dict[Text, Axes]]: ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions