Skip to content

[Doc]: annotation_clip=None not correctly documented #22563

@trichter

Description

@trichter

Documentation Link

https://matplotlib.org/devdocs/api/_as_gen/matplotlib.axes.Axes.annotate.html?highlight=annotate#matplotlib.axes.Axes.annotate

Problem

The documentation of Axes.annotate resp. mpl.text.Annotate states about annotation_clip parameter:

https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/text.py#L1776

        annotation_clip : bool or None, default: None
            Whether to draw the annotation when the annotation point *xy* is
            outside the axes area.
            - If *True*, the annotation will only be drawn when *xy* is
              within the axes.
            - If *False*, the annotation will always be drawn.
            - If *None*, the annotation will only be drawn when *xy* is
              within the axes and *xycoords* is 'data'.

Suggested improvement

I think the behavior is different for the default annotation_clip=None.

It should be

  • If None, the annotation will only be drawn when xy is
    within the axes and or xycoords is not 'data'.

Because this sounds a bit complicated, I'd suggest

        annotation_clip : bool or None, default: None
            Whether to clip (i.e. not draw) the annotation when the annotation point *xy* is
            outside the axes area.
            - If *True*, the annotation will be clipped when *xy* is outside the axes.
            - If *False*, the annotation will always be drawn.
            - If *None*, the annotation will be clipped when *xy* is outside the axes and *xycoords* is 'data'.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions