Skip to content

Commit 2fa96ed

Browse files
authored
Merge pull request matplotlib#30109 from rcomer/petroff-styles
2 parents 74ae218 + 05b0a4e commit 2fa96ed

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

galleries/examples/style_sheets/petroff10.py

Lines 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)