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

Appearance settings

Non interpolated placeholder value in docstring. #19292

Copy link
Copy link
Closed
@Carreau

Description

@Carreau
Issue body actions

Problem

matplotlib.pyplot.axvspan, and respectively matplotlib.pyplot.Axes.axvspan still have the raw %(Polygon) on 3.3.3 and %(Polygon_kwdoc)s on master not interpolated in the docstring. As can be see
here online or via matplotlib.pyplot.Axes.axvspan? in IPython.

%(Rectangle_kwdocs)s is also present in matplotlib.axes.Axes.indicate_inset as well.

A couple of other %(...) are detectable in other docstring but are either purposeful, or private AFAICT.

In addition a number of extra formatting seem to be done but are no-op, quick grep through source code:

...
 rg _kwdoc | cut -f2 -d: | tr -d ' '  | sort | uniq
%(Axes3D_kwdoc)s
%(Axes_kwdoc)s
%(BrokenBarHCollection_kwdoc)s
%(Line2D_kwdoc)s
%(Patch_kwdoc)s
%(PolyCollection_kwdoc)s
%(Polygon_kwdoc)s
%(QuadMesh_kwdoc)s
%(Rectangle_kwdoc)s
%(Table_kwdoc)s
%(Text_kwdoc)s
_artist_kwdoc=artist.kwdoc(Collection)
_patch_kwdoc=artist.kwdoc(Patch)
docstring.interpd.update(Artist_kwdoc=kwdoc(Artist))
docstring.interpd.update(Axes3D_kwdoc=artist.kwdoc(Axes3D))
docstring.interpd.update(Axes_kwdoc=martist.kwdoc(Axes))
docstring.interpd.update(Figure_kwdoc=martist.kwdoc(Figure))
docstring.interpd.update(Line2D_kwdoc=artist.kwdoc(Line2D))
docstring.interpd.update(LineCollection_kwdoc=artist.kwdoc(LineCollection))
docstring.interpd.update(Subplot_kwdoc=martist.kwdoc(Axes))
docstring.interpd.update(Table_kwdoc=artist.kwdoc(Table))
docstring.interpd.update(Text_kwdoc=artist.kwdoc(Text))
docstring.interpd.update({f'{k}_kwdoc'

Of which the following have no matching targets:

Artist_kwdoc=kwdoc(Artist))
Figure_kwdoc=martist.kwdoc(Figure))
LineCollection_kwdoc=artist.kwdoc(LineCollection))
Subplot_kwdoc=martist.kwdoc(Axes))

Note also the docstring.interpd.update({f'{k}_kwdoc' present in two files that loops over many values:

$ rg \}_kwdoc -B4
lib/matplotlib/collections.py
2085-for k in ('QuadMesh', 'TriMesh', 'PolyCollection', 'BrokenBarHCollection',
2086-          'RegularPolyCollection', 'PathCollection',
2087-          'StarPolygonCollection', 'PatchCollection',
2088-          'CircleCollection', 'Collection',):
2089:    docstring.interpd.update({f'{k}_kwdoc': _artist_kwdoc})

lib/matplotlib/patches.py
627-_patch_kwdoc = artist.kwdoc(Patch)
628-for k in ['Rectangle', 'Circle', 'RegularPolygon', 'Polygon', 'Wedge', 'Arrow',
629-          'FancyArrow', 'CirclePolygon', 'Ellipse', 'Arc', 'FancyBboxPatch',
630-          'Patch']:
631:    docstring.interpd.update({f'{k}_kwdoc': _patch_kwdoc})

Circle, Ellipses, Arc,... etc have no corresponding target, my guess is that this may contribute to import slowdown on matplotlib if each docstring formatting have to carry all this extra information.

Suggested Improvement

Fix matplotlib.axes.Axes.indicate_inset and axvspan to get properly formatted; not sure why they aren't. Maybe add a check in docstring.interpd and docstring.dedent_interpd to make sure there is no remaining %(...) after formatting ? and try to remove the unnecessary collection of format target.

Matplotlib version

  • Operating system: Mac OS, online docs
  • Matplotlib version: 3.3.3 and master branch
  • Matplotlib documentation version: 3.3.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.