Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix doc references in subclasses of mpl._enum members #20174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/matplotlib/_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
10 changes: 6 additions & 4 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand Down
16 changes: 8 additions & 8 deletions lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -1373,15 +1373,15 @@ 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`.
"""
return self._dashjoinstyle.name

def get_solid_joinstyle(self):
"""
Return the `.JoinStyle` for solid lines.
Return the %(JoinStyleLink)s for solid lines.

See also `~.Line2D.set_solid_joinstyle`.
"""
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -1421,15 +1421,15 @@ 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`.
"""
return self._dashcapstyle.name

def get_solid_capstyle(self):
"""
Return the `.CapStyle` for solid lines.
Return the %(CapStyleLink)s for solid lines.

See also `~.Line2D.set_solid_capstyle`.
"""
Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down