diff --git a/lib/matplotlib/_enums.py b/lib/matplotlib/_enums.py index c8c50f7c3028..28071cb7c5a5 100644 --- a/lib/matplotlib/_enums.py +++ b/lib/matplotlib/_enums.py @@ -181,5 +181,9 @@ def demo(): + ", ".join([f"'{cs.name}'" for cs in CapStyle]) \ + "}" -_docstring.interpd.update({'JoinStyle': JoinStyle.input_description, - 'CapStyle': CapStyle.input_description}) +docstring.interpd.update({ + 'JoinStyleLink': '`~matplotlib._enums.JoinStyle`', + 'JoinStyle': JoinStyle.input_description, + 'CapStyleLink': '`~matplotlib._enums.CapStyle`', + 'CapStyle': CapStyle.input_description +}) diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 7e62d1a5be1a..9ca5f8387ebe 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -801,8 +801,9 @@ def get_antialiased(self): """Return whether the object should try to do antialiased rendering.""" return self._antialiased + @docstring.interpd def get_capstyle(self): - """Return the `.CapStyle`.""" + """Return the %(CapStyleLink)s.""" return self._capstyle.name def get_clip_rectangle(self): @@ -843,8 +844,9 @@ def get_forced_alpha(self): """ return self._forced_alpha + @docstring.interpd def get_joinstyle(self): - """Return the `.JoinStyle`.""" + """Return the %(JoinStyleLink)s.""" return self._joinstyle.name def get_linewidth(self): @@ -903,7 +905,7 @@ def set_capstyle(self, cs): Parameters ---------- - cs : `.CapStyle` or %(CapStyle)s + cs : %(CapStyleLink)s or %(CapStyle)s """ self._capstyle = CapStyle(cs) @@ -973,7 +975,7 @@ def set_joinstyle(self, js): Parameters ---------- - js : `.JoinStyle` or %(JoinStyle)s + js : %(JoinStyleLink)s or %(JoinStyle)s """ self._joinstyle = JoinStyle(js) diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index 8aba85a67e0a..14ebe5a2f52b 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -115,10 +115,10 @@ def __init__(self, where *onoffseq* is an even length tuple of on and off ink lengths in points. For examples, see :doc:`/gallery/lines_bars_and_markers/linestyles`. - capstyle : `.CapStyle`-like, default: :rc:`patch.capstyle` + capstyle : %(CapStyleLink)s-like, default: :rc:`patch.capstyle` Style to use for capping lines for all paths in the collection. Allowed values are %(CapStyle)s. - joinstyle : `.JoinStyle`-like, default: :rc:`patch.joinstyle` + joinstyle : %(JoinStyleLink)s-like, default: :rc:`patch.joinstyle` Style to use for joining lines for all paths in the collection. Allowed values are %(JoinStyle)s. antialiaseds : bool or list of bool, default: :rc:`patch.antialiased` @@ -630,11 +630,11 @@ def set_linestyle(self, ls): @_docstring.interpd def set_capstyle(self, cs): """ - Set the `.CapStyle` for the collection (for all its elements). + Set the %(CapStyleLink)s for the collection (for all its elements). Parameters ---------- - cs : `.CapStyle` or %(CapStyle)s + cs : %(CapStyleLink)s or %(CapStyle)s """ self._capstyle = CapStyle(cs) @@ -644,11 +644,11 @@ def get_capstyle(self): @_docstring.interpd def set_joinstyle(self, js): """ - Set the `.JoinStyle` for the collection (for all its elements). + Set the %(JoinStyleLink)s for the collection (for all its elements). Parameters ---------- - js : `.JoinStyle` or %(JoinStyle)s + js : %(JoinStyleLink)s or %(JoinStyle)s """ self._joinstyle = JoinStyle(js) diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 8df89373adf1..bc56ee611630 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -1348,7 +1348,7 @@ def set_dash_joinstyle(self, s): Parameters ---------- - s : `.JoinStyle` or %(JoinStyle)s + s : %(JoinStyleLink)s or %(JoinStyle)s """ js = JoinStyle(s) if self._dashjoinstyle != js: @@ -1364,7 +1364,7 @@ def set_solid_joinstyle(self, s): Parameters ---------- - s : `.JoinStyle` or %(JoinStyle)s + s : %(JoinStyleLink)s or %(JoinStyle)s """ js = JoinStyle(s) if self._solidjoinstyle != js: @@ -1373,7 +1373,7 @@ def set_solid_joinstyle(self, s): def get_dash_joinstyle(self): """ - Return the `.JoinStyle` for dashed lines. + Return the %(JoinStyleLink)s for dashed lines. See also `~.Line2D.set_dash_joinstyle`. """ @@ -1381,7 +1381,7 @@ def get_dash_joinstyle(self): def get_solid_joinstyle(self): """ - Return the `.JoinStyle` for solid lines. + Return the %(JoinStyleLink)s for solid lines. See also `~.Line2D.set_solid_joinstyle`. """ @@ -1396,7 +1396,7 @@ def set_dash_capstyle(self, s): Parameters ---------- - s : `.CapStyle` or %(CapStyle)s + s : %(CapStyleLink)s or %(CapStyle)s """ cs = CapStyle(s) if self._dashcapstyle != cs: @@ -1412,7 +1412,7 @@ def set_solid_capstyle(self, s): Parameters ---------- - s : `.CapStyle` or %(CapStyle)s + s : %(CapStyleLink)s or %(CapStyle)s """ cs = CapStyle(s) if self._solidcapstyle != cs: @@ -1421,7 +1421,7 @@ def set_solid_capstyle(self, s): def get_dash_capstyle(self): """ - Return the `.CapStyle` for dashed lines. + Return the %(CapStyleLink)s for dashed lines. See also `~.Line2D.set_dash_capstyle`. """ @@ -1429,7 +1429,7 @@ def get_dash_capstyle(self): def get_solid_capstyle(self): """ - Return the `.CapStyle` for solid lines. + Return the %(CapStyleLink)s for solid lines. See also `~.Line2D.set_solid_capstyle`. """ diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index 76e65859ac73..b823ed660441 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -454,14 +454,14 @@ def get_fill(self): @_docstring.interpd def set_capstyle(self, s): """ - Set the `.CapStyle`. + Set the %(CapStyleLink)s. The default capstyle is 'round' for `.FancyArrowPatch` and 'butt' for all other patches. Parameters ---------- - s : `.CapStyle` or %(CapStyle)s + s : %(CapStyleLink)s or %(CapStyle)s """ cs = CapStyle(s) self._capstyle = cs @@ -474,14 +474,14 @@ def get_capstyle(self): @_docstring.interpd def set_joinstyle(self, s): """ - Set the `.JoinStyle`. + Set the %(JoinStyleLink)s. The default joinstyle is 'round' for `.FancyArrowPatch` and 'miter' for all other patches. Parameters ---------- - s : `.JoinStyle` or %(JoinStyle)s + s : %(JoinStyleLink)s or %(JoinStyle)s """ js = JoinStyle(s) self._joinstyle = js