Skip to content

Backport PR #22053 on branch v3.5.x (DOC: Document default cap styles) #22201

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

Merged
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
4 changes: 3 additions & 1 deletion lib/matplotlib/_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ class CapStyle(str, _AutoStringNameEnum):
For a visual impression of each *CapStyle*, `view these docs online
<CapStyle>` or run `CapStyle.demo`.

By default, `~.backend_bases.GraphicsContextBase` draws a stroked line as
squared off at its endpoints.

**Supported values:**

.. rst-class:: value-list
Expand Down Expand Up @@ -168,7 +171,6 @@ def demo():
ax.plot(xx, yy, lw=12, color='tab:blue', solid_capstyle=style)
ax.plot(xx, yy, lw=1, color='black')
ax.plot(xx, yy, 'o', color='tab:red', markersize=3)
ax.text(2.25, 0.55, '(default)', ha='center')

ax.set_ylim(-.5, 1.5)
ax.set_axis_off()
Expand Down
4 changes: 4 additions & 0 deletions lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,8 @@ def set_dash_capstyle(self, s):
"""
How to draw the end caps if the line is `~Line2D.is_dashed`.

The default capstyle is :rc:`lines.dash_capstyle`.

Parameters
----------
s : `.CapStyle` or %(CapStyle)s
Expand All @@ -1351,6 +1353,8 @@ def set_solid_capstyle(self, s):
"""
How to draw the end caps if the line is solid (not `~Line2D.is_dashed`)

The default capstyle is :rc:`lines.solid_capstyle`.

Parameters
----------
s : `.CapStyle` or %(CapStyle)s
Expand Down
3 changes: 3 additions & 0 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@ def set_capstyle(self, s):
"""
Set the `.CapStyle`.

The default capstyle is 'round' for `.FancyArrowPatch` and 'butt' for
all other patches.

Parameters
----------
s : `.CapStyle` or %(CapStyle)s
Expand Down