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

Skip to content

DOC: expand petroff10 example to include 6- and 8- styles #30109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions galleries/examples/style_sheets/petroff10.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""
=====================
Petroff10 style sheet
=====================
====================
Petroff style sheets
====================

This example demonstrates the "petroff10" style, which implements the 10-color
sequence developed by Matthew A. Petroff [1]_ for accessible data visualization.
The style balances aesthetics with accessibility considerations, making it
suitable for various types of plots while ensuring readability and distinction
between data series.
This example demonstrates the "petroffN" styles, which implement the 6-, 8- and
10-color sequences developed by Matthew A. Petroff [1]_ for accessible data
visualization. The styles balance aesthetics with accessibility considerations,
making them suitable for various types of plots while ensuring readability and
distinction between data series.

.. [1] https://arxiv.org/abs/2107.02270

Expand Down Expand Up @@ -35,9 +35,15 @@ def image_and_patch_example(ax):
c = plt.Circle((5, 5), radius=5, label='patch')
ax.add_patch(c)

plt.style.use('petroff10')
fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(12, 5))
fig.suptitle("'petroff10' style sheet")
colored_lines_example(ax1)
image_and_patch_example(ax2)

fig = plt.figure(figsize=(6.4, 9.6), layout='compressed')
sfigs = fig.subfigures(nrows=3)

for style, sfig in zip(['petroff6', 'petroff8', 'petroff10'], sfigs):
sfig.suptitle(f"'{style}' style sheet")
with plt.style.context(style):
ax1, ax2 = sfig.subplots(ncols=2)
colored_lines_example(ax1)
image_and_patch_example(ax2)

plt.show()