From b24acb7772e0534f4bcdb0b5b492d9d94954dd91 Mon Sep 17 00:00:00 2001 From: Steffen Rehberg Date: Mon, 27 Dec 2021 13:12:42 +0100 Subject: [PATCH] DOC: Document default cap styles - remove '(default)' from cap style demo as this is only true for Line2D and the default rcParameters - document default cap styles for Line2D and Patch in their cap style setters - document default cap style for GraphicsContextBase in the same way as it's already done for joinstyle --- lib/matplotlib/_enums.py | 4 +++- lib/matplotlib/lines.py | 4 ++++ lib/matplotlib/patches.py | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/_enums.py b/lib/matplotlib/_enums.py index b1361c6f72ba..b15956babbab 100644 --- a/lib/matplotlib/_enums.py +++ b/lib/matplotlib/_enums.py @@ -128,6 +128,9 @@ class CapStyle(str, _AutoStringNameEnum): For a visual impression of each *CapStyle*, `view these docs online ` 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 @@ -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() diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 8190ca96b58a..1e9341f0b98a 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -1336,6 +1336,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 @@ -1350,6 +1352,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 diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index 6423dba60ff5..e4dc7ee1a646 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -474,6 +474,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