Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9ecae2

Browse files
committed
DOC: correct linestyle example and reference rcParams
1 parent df1e039 commit c9ecae2

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

galleries/examples/lines_bars_and_markers/linestyles.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
``(offset, (on_off_seq))``. For example, ``(0, (3, 10, 1, 15))`` means
99
(3pt line, 10pt space, 1pt line, 15pt space) with no offset, while
1010
``(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`
1217
1318
*Note*: The dash style can also be configured via `.Line2D.set_dashes`
1419
as shown in :doc:`/gallery/lines_bars_and_markers/line_demo_dash_control`
@@ -20,14 +25,15 @@
2025

2126
linestyle_str = [
2227
('solid', 'solid'), # Same as (0, ()) or '-'
23-
('dotted', 'dotted'), # Same as (0, (1, 1)) or ':'
28+
('dotted', 'dotted'), # Same as ':'
2429
('dashed', 'dashed'), # Same as '--'
2530
('dashdot', 'dashdot')] # Same as '-.'
2631

2732
linestyle_tuple = [
2833
('loosely dotted', (0, (1, 10))),
29-
('dotted', (0, (1, 1))),
34+
('dotted', (0, (1, 5))),
3035
('densely dotted', (0, (1, 1))),
36+
3137
('long dash with offset', (5, (10, 3))),
3238
('loosely dashed', (0, (5, 10))),
3339
('dashed', (0, (5, 5))),
@@ -66,12 +72,12 @@ def plot_linestyles(ax, linestyles, title):
6672
color="blue", fontsize=8, ha="right", family="monospace")
6773

6874

69-
fig, (ax0, ax1) = plt.subplots(2, 1, figsize=(10, 8), height_ratios=[1, 3])
75+
fig, (ax0, ax1) = plt.subplots(2, 1, figsize=(7, 8), height_ratios=[1, 3],
76+
layout='constrained')
7077

7178
plot_linestyles(ax0, linestyle_str[::-1], title='Named linestyles')
7279
plot_linestyles(ax1, linestyle_tuple[::-1], title='Parametrized linestyles')
7380

74-
plt.tight_layout()
7581
plt.show()
7682

7783
# %%

0 commit comments

Comments
 (0)