Skip to content

Raise error if argument to xlim is invalid, e.g., nan #7460

Closed
@anntzer

Description

@anntzer

As of 2.0b4, passing nan as a limit to xlim seems to reset both limits to (-0.001, 0.001) (try e.g. with plt.plot([0, 1]); plt.xlim(right=np.nan)). I think this should either error, or, more usefully, be interpreted as None (i.e. leave that limit as is). (For extra points, we can also bikeshed what passing inf to xlim should mean.)

The main use case would be when the xlim is read from some float context (e.g. from an array) where you can easily store nan but not None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions