diff --git a/galleries/examples/lines_bars_and_markers/linestyles.py b/galleries/examples/lines_bars_and_markers/linestyles.py index 9f1829670c65..25b053e912bd 100644 --- a/galleries/examples/lines_bars_and_markers/linestyles.py +++ b/galleries/examples/lines_bars_and_markers/linestyles.py @@ -8,7 +8,12 @@ ``(offset, (on_off_seq))``. For example, ``(0, (3, 10, 1, 15))`` means (3pt line, 10pt space, 1pt line, 15pt space) with no offset, while ``(5, (10, 3))``, means (10pt line, 3pt space), but skip the first 5pt line. -See also `.Line2D.set_linestyle`. +See also `.Line2D.set_linestyle`. The specific on/off sequences of the +"dotted", "dashed" and "dashdot" styles are configurable: + +* :rc:`lines.dotted_pattern` +* :rc:`lines.dashed_pattern` +* :rc:`lines.dashdot_pattern` *Note*: The dash style can also be configured via `.Line2D.set_dashes` as shown in :doc:`/gallery/lines_bars_and_markers/line_demo_dash_control` @@ -20,14 +25,15 @@ linestyle_str = [ ('solid', 'solid'), # Same as (0, ()) or '-' - ('dotted', 'dotted'), # Same as (0, (1, 1)) or ':' + ('dotted', 'dotted'), # Same as ':' ('dashed', 'dashed'), # Same as '--' ('dashdot', 'dashdot')] # Same as '-.' linestyle_tuple = [ ('loosely dotted', (0, (1, 10))), - ('dotted', (0, (1, 1))), + ('dotted', (0, (1, 5))), ('densely dotted', (0, (1, 1))), + ('long dash with offset', (5, (10, 3))), ('loosely dashed', (0, (5, 10))), ('dashed', (0, (5, 5))), @@ -66,12 +72,12 @@ def plot_linestyles(ax, linestyles, title): color="blue", fontsize=8, ha="right", family="monospace") -fig, (ax0, ax1) = plt.subplots(2, 1, figsize=(10, 8), height_ratios=[1, 3]) +fig, (ax0, ax1) = plt.subplots(2, 1, figsize=(7, 8), height_ratios=[1, 3], + layout='constrained') plot_linestyles(ax0, linestyle_str[::-1], title='Named linestyles') plot_linestyles(ax1, linestyle_tuple[::-1], title='Parametrized linestyles') -plt.tight_layout() plt.show() # %%