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

Subclasses of Polygon with numpydoc xref throws error b/c of CapStyle, JoinStyle #19839

Closed as not planned
@nstarman

Description

@nstarman

Problem

The sphinx links toCapStyle andJoinStyle in v3.4.0 are relative to the file, so a subclass ofmatplotlib.patches.Patch in a package with numpydoc xref (https://numpydoc.readthedocs.io/en/latest/install.html) turned on cannot link to the objects and errors with.
WARNING: py:obj reference target not found: CapStyle
WARNING: py:obj reference target not found: JoinStyle

https://matplotlib.org/stable/api/_as_gen/matplotlib.patches.Patch.html#matplotlib.patches.Patch.set_capstyle
https://matplotlib.org/stable/api/_as_gen/matplotlib.patches.Patch.html#matplotlib.patches.Patch.set_joinstyle

   @docstring.interpd    def set_capstyle(self, s):        """        Set the `.CapStyle`.        Parameters        ----------        s : `.CapStyle` or %(CapStyle)s        """        cs = CapStyle(s)        self._capstyle = cs        self.stale = True

Edit:

The problem also appears to involvePatches.__init__. I can monkey-patch a fix with

Polygon.__init__.__doc__ = Polygon.__init__.__doc__.replace(    "`.CapStyle`", "``matplotlib._enums.CapStyle``")Polygon.__init__.__doc__ = Polygon.__init__.__doc__.replace(    "`.JoinStyle`", "``matplotlib._enums.JoinStyle``")Polygon.set_capstyle.__doc__ = Polygon.set_capstyle.__doc__.replace(    "`.CapStyle`", "``matplotlib._enums.CapStyle``")Polygon.set_joinstyle.__doc__ = Polygon.set_joinstyle.__doc__.replace(    "`.JoinStyle`", "``matplotlib._enums.JoinStyle``")

Suggested Improvement

  • This line could be be changed to say
   @docstring.interpd    def set_capstyle(self, s):        """        Set the `~matplotlib._enums.CapStyle`.        Parameters        ----------        s : `~matplotlib._enums.CapStyle` or %(CapStyle)s        """        cs = CapStyle(s)        self._capstyle = cs        self.stale = True

Matplotlib version

  • Operating system: Big Sur & Ubuntu
  • Matplotlib version 3.4.0
  • Matplotlib documentation version (is listed under the logo): 3.4.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp