Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

matthewfeickert
Copy link
Contributor

@matthewfeickertmatthewfeickert commentedMay 18, 2025
edited
Loading

PR summary

Add the 6 color and the 8 color Petroff color cycles from@mpetroff'sMatthew A. Petroff, Accessible Color Sequences for Data Visualization. The 10 color cycle was added in PR#27851 which landed in Matplotlib v3.10.0.

PR checklist

* Add the 6 color and the 8 color Petroff color cycles from  Matthew A. Petroff, Accessible Color Sequences for Data Visualizationhttps://arxiv.org/abs/2107.02270.  The 10 color cycle was added in PR 27851 which landed in Matplotlib v3.10.0.
* Verify they appear in plt.color_sequences.
* Note the addition of 'petroff6' and 'petroff8' and give an example  of how to load them.
@matthewfeickertmatthewfeickertforce-pushed theenh/add-petroff6-and-petroff8 branch from5127e01 tob89e4ceCompareMay 18, 2025 07:58
@matthewfeickertmatthewfeickert marked this pull request as ready for reviewMay 18, 2025 07:59
@matthewfeickert
Copy link
ContributorAuthor

matthewfeickert commentedMay 18, 2025
edited
Loading

This should also become part of Issue#28750. This PR is just implementing the same components as PR#27851 did forpetroff10, and so could be viewed as the bare minimum. If this isn't desirable without solving Issue#28750 in the same PR, that's fine, but I'll probably need additional guidance and won't have time to do something of that level of detail until June 2025.

@matthewfeickert
Copy link
ContributorAuthor

matthewfeickert commentedMay 18, 2025
edited
Loading

Tagging@timhoffm and@rcomer for review given discussion in Issue#30060 and tagging@tacaswell given review of PR#27851.

@mpetroff, your review is of course welcome too.

mpetroff reacted with thumbs up emoji

Copy link
ContributorAuthor

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 usinghttps://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.

Copy link
Member

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

Copy link
Contributor

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 thetop-cycles.json file to the format here:

#!/usr/bin/env python3importjsonwithopen("top-cycles.json")asinfile:cycles=json.load(infile)forkincycles:print(f"_petroff{k}_data = (")forcincycles[k]:cf= [str(int(c[i*2 : (i+1)*2],16)/255)foriinrange(3)]print(f"    ({cf[0]+',':20}{cf[1]+',':20}{cf[2]+'),':22}  #{c}")print(")\n")

matthewfeickert and oscargus reacted with thumbs up emoji
@rcomer
Copy link
Member

Thanks for following this up@matthewfeickert! Could you also add the new sequences to the list inthis example? It might also be good to turnthis one into a comparison of the three Petroff style sheets, but that could be a follow up.

matthewfeickert reacted with thumbs up emoji

@matthewfeickert
Copy link
ContributorAuthor

Could you also add the new sequences to the list inthis example? It might also be good to turnthis one into a comparison of the three Petroff style sheets, but that could be a follow up.

@rcomer For sure. I am teaching at a workshop for the next two days so I might be delayed in doing this until very late tonight, but I'll ping you for review once I've done so.

I'll also update the values (if different) using@mpetroff's code snippet from#30065 (comment).

@mpetroff
Copy link
Contributor

I'll also update the values (if different) using@mpetroff's code snippet from#30065 (comment).

They're identical, so there's no update needed.

@tacaswelltacaswell added this to thev3.11.0 milestoneMay 19, 2025
@tacaswell
Copy link
Member

The test drop is due to at least one missing CI upload.

matthewfeickert reacted with thumbs up emoji

@tacaswelltacaswell merged commit1c881a3 intomatplotlib:mainMay 19, 2025
38 of 39 checks passed
@matthewfeickertmatthewfeickert deleted the enh/add-petroff6-and-petroff8 branchMay 20, 2025 04:47
@matthewfeickert
Copy link
ContributorAuthor

Thanks for the reviews everyone and for the fast merge@tacaswell.

Could you also add the new sequences to the list inthis example? It might also be good to turnthis one into a comparison of the three Petroff style sheets, but that could be a follow up.

@rcomer I'll follow up in another PR on this so that it doesn't get dropped.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mpetroffmpetroffmpetroff left review comments

@tacaswelltacaswelltacaswell approved these changes

@oscargusoscargusoscargus approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.11.0
Development

Successfully merging this pull request may close these issues.

Add the 6 color and 8 color sequence for the Petroff color cycles
5 participants
@matthewfeickert@rcomer@mpetroff@tacaswell@oscargus

[8]ページ先頭

©2009-2025 Movatter.jp