|
1 | 1 | """
|
2 |
| -===================== |
3 |
| -Petroff10 style sheet |
4 |
| -===================== |
| 2 | +==================== |
| 3 | +Petroff style sheets |
| 4 | +==================== |
5 | 5 |
|
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. |
11 | 11 |
|
12 | 12 | .. [1] https://arxiv.org/abs/2107.02270
|
13 | 13 |
|
@@ -35,9 +35,15 @@ def image_and_patch_example(ax):
|
35 | 35 | c = plt.Circle((5, 5), radius=5, label='patch')
|
36 | 36 | ax.add_patch(c)
|
37 | 37 |
|
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 | + |
43 | 49 | plt.show()
|
0 commit comments