8
8
``(offset, (on_off_seq))``. For example, ``(0, (3, 10, 1, 15))`` means
9
9
(3pt line, 10pt space, 1pt line, 15pt space) with no offset, while
10
10
``(5, (10, 3))``, means (10pt line, 3pt space), but skip the first 5pt line.
11
- See also `.Line2D.set_linestyle`.
11
+ See also `.Line2D.set_linestyle`. The specific on/off sequences of the
12
+ "dotted", "dashed" and "dashdot" styles are configurable:
13
+
14
+ * :rc:`lines.dotted_pattern`
15
+ * :rc:`lines.dashed_pattern`
16
+ * :rc:`lines.dashdot_pattern`
12
17
13
18
*Note*: The dash style can also be configured via `.Line2D.set_dashes`
14
19
as shown in :doc:`/gallery/lines_bars_and_markers/line_demo_dash_control`
20
25
21
26
linestyle_str = [
22
27
('solid' , 'solid' ), # Same as (0, ()) or '-'
23
- ('dotted' , 'dotted' ), # Same as (0, (1, 1)) or ':'
28
+ ('dotted' , 'dotted' ), # Same as ':'
24
29
('dashed' , 'dashed' ), # Same as '--'
25
30
('dashdot' , 'dashdot' )] # Same as '-.'
26
31
27
32
linestyle_tuple = [
28
33
('loosely dotted' , (0 , (1 , 10 ))),
29
- ('dotted' , (0 , (1 , 1 ))),
34
+ ('dotted' , (0 , (1 , 5 ))),
30
35
('densely dotted' , (0 , (1 , 1 ))),
31
36
('long dash with offset' , (5 , (10 , 3 ))),
32
37
('loosely dashed' , (0 , (5 , 10 ))),
@@ -66,12 +71,12 @@ def plot_linestyles(ax, linestyles, title):
66
71
color = "blue" , fontsize = 8 , ha = "right" , family = "monospace" )
67
72
68
73
69
- fig , (ax0 , ax1 ) = plt .subplots (2 , 1 , figsize = (10 , 8 ), height_ratios = [1 , 3 ])
74
+ fig , (ax0 , ax1 ) = plt .subplots (2 , 1 , figsize = (7 , 8 ), height_ratios = [1 , 3 ],
75
+ layout = 'constrained' )
70
76
71
77
plot_linestyles (ax0 , linestyle_str [::- 1 ], title = 'Named linestyles' )
72
78
plot_linestyles (ax1 , linestyle_tuple [::- 1 ], title = 'Parametrized linestyles' )
73
79
74
- plt .tight_layout ()
75
80
plt .show ()
76
81
77
82
# %%
0 commit comments