Closed as not planned
Closed as not planned
Description
Problem
The sphinx links to CapStyle
and JoinStyle
in v3.4.0 are relative to the file, so a subclass of matplotlib.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 involve Patches.__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