Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a1c4c21

Browse filesBrowse files
committed
DOC: correct linestyle example and reference rcParams
1 parent df1e039 commit a1c4c21
Copy full SHA for a1c4c21

File tree

Expand file treeCollapse file tree

1 file changed

+10
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-5
lines changed

‎galleries/examples/lines_bars_and_markers/linestyles.py

Copy file name to clipboardExpand all lines: galleries/examples/lines_bars_and_markers/linestyles.py
+10-5Lines changed: 10 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,13 +25,13 @@
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))),
3136
('long dash with offset', (5, (10, 3))),
3237
('loosely dashed', (0, (5, 10))),
@@ -66,12 +71,12 @@ def plot_linestyles(ax, linestyles, title):
6671
color="blue", fontsize=8, ha="right", family="monospace")
6772

6873

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')
7076

7177
plot_linestyles(ax0, linestyle_str[::-1], title='Named linestyles')
7278
plot_linestyles(ax1, linestyle_tuple[::-1], title='Parametrized linestyles')
7379

74-
plt.tight_layout()
7580
plt.show()
7681

7782
# %%

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.