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 05b0a4e

Browse filesBrowse files
committed
DOC: expand petroff10 example to include 6- and 8- styles
1 parent 74ae218 commit 05b0a4e
Copy full SHA for 05b0a4e

File tree

Expand file treeCollapse file tree

1 file changed

+19
-13
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+19
-13
lines changed

‎galleries/examples/style_sheets/petroff10.py

Copy file name to clipboardExpand all lines: galleries/examples/style_sheets/petroff10.py
+19-13Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""
2-
=====================
3-
Petroff10 style sheet
4-
=====================
2+
====================
3+
Petroff style sheets
4+
====================
55
6-
This example demonstrates the "petroff10" style, which implements the 10-color
7-
sequence developed by Matthew A. Petroff [1]_ for accessible data visualization.
8-
The style balances aesthetics with accessibility considerations, making it
9-
suitable for various types of plots while ensuring readability and distinction
10-
between data series.
6+
This example demonstrates the "petroffN" styles, which implement the 6-, 8- and
7+
10-color sequences developed by Matthew A. Petroff [1]_ for accessible data
8+
visualization. The styles balance aesthetics with accessibility considerations,
9+
making them suitable for various types of plots while ensuring readability and
10+
distinction between data series.
1111
1212
.. [1] https://arxiv.org/abs/2107.02270
1313
@@ -35,9 +35,15 @@ def image_and_patch_example(ax):
3535
c = plt.Circle((5, 5), radius=5, label='patch')
3636
ax.add_patch(c)
3737

38-
plt.style.use('petroff10')
39-
fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(12, 5))
40-
fig.suptitle("'petroff10' style sheet")
41-
colored_lines_example(ax1)
42-
image_and_patch_example(ax2)
38+
39+
fig = plt.figure(figsize=(6.4, 9.6), layout='compressed')
40+
sfigs = fig.subfigures(nrows=3)
41+
42+
for style, sfig in zip(['petroff6', 'petroff8', 'petroff10'], sfigs):
43+
sfig.suptitle(f"'{style}' style sheet")
44+
with plt.style.context(style):
45+
ax1, ax2 = sfig.subplots(ncols=2)
46+
colored_lines_example(ax1)
47+
image_and_patch_example(ax2)
48+
4349
plt.show()

0 commit comments

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