-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ENH: Add Petroff 6 and 8 color cycle style sheets #30065
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
tacaswell
merged 3 commits into
matplotlib:main
from
matthewfeickert:enh/add-petroff6-and-petroff8
May 19, 2025
+58
−1
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
doc/users/next_whats_new/six_and_eight_color_petroff_color_cycles.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Six and eight color Petroff color cycles | ||
---------------------------------------- | ||
|
||
The six and eight color accessible Petroff color cycles are named 'petroff6' and | ||
'petroff8'. | ||
They compliment the existing 'petroff10' color cycle, added in `Matplotlib 3.10.0`_ | ||
|
||
For more details see | ||
`Petroff, M. A.: "Accessible Color Sequences for Data Visualization" | ||
<https://arxiv.org/abs/2107.02270>`_. | ||
To load the 'petroff6' color cycle in place of the default:: | ||
|
||
import matplotlib.pyplot as plt | ||
plt.style.use('petroff6') | ||
|
||
or to load the 'petroff8' color cycle:: | ||
|
||
import matplotlib.pyplot as plt | ||
plt.style.use('petroff8') | ||
|
||
.. _Matplotlib 3.10.0: https://matplotlib.org/stable/users/prev_whats_new/whats_new_3.10.0.html#new-more-accessible-color-cycle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Color cycle survey palette from Petroff (2021): | ||
# https://arxiv.org/abs/2107.02270 | ||
# https://github.com/mpetroff/accessible-color-cycles | ||
axes.prop_cycle: cycler('color', ['5790fc', 'f89c20', 'e42536', '964a8b', '9c9ca1', '7a21dd']) | ||
patch.facecolor: 5790fc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Color cycle survey palette from Petroff (2021): | ||
# https://arxiv.org/abs/2107.02270 | ||
# https://github.com/mpetroff/accessible-color-cycles | ||
axes.prop_cycle: cycler('color', ['1845fb', 'ff5e02', 'c91f16', 'c849a9', 'adad7d', '86c8dd', '578dff', '656364']) | ||
patch.facecolor: 1845fb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RGB values were determiend from converting the hex using https://www.rapidtables.com/convert/color/hex-to-rgb.html. If a more specific method is desired, I'm happy to double check the RGB values with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should do, since screens have much more difference between them than a single RGB color step anyway.
(Since I didn't know which was the original format, I did some conversions, thinking that the RGB was the approximation of the 0-1-range. And then read the paper to see that it was the other way around. It seems to match exactly.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code will exactly convert the
top-cycles.json
file to the format here: