From ae7f9735a5c863a6209c8d09c385e20b83103c51 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Tue, 11 Jan 2022 19:12:44 +0100 Subject: [PATCH] Backport PR #22053: DOC: Document default cap styles --- 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 3e4393e7979d..28650dd369d9 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 273a93c0b86f..1014c497d9c5 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -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 @@ -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 diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index 253e8abe2ef7..adcf2a1b1a77 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -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