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

DOC: update colors from colormaps example#27708

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

Merged
story645 merged 1 commit intomatplotlib:mainfromrcomer:color-from-cmap-2
Feb 4, 2024

Conversation

rcomer
Copy link
Member

PR summary

Follow up to#27678 based on comments there from@timhoffm.

PR checklist



from cycler import cycler

cmap = mpl.colormaps.get_cmap('Dark2')
colors = cmap(range(cmap.N)) # cmap.N is number of unique colors in the colormap
colors = mpl.colormaps['Dark2'].colors
Copy link
MemberAuthor

@rcomerrcomerJan 26, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

#27678 started out using thecolors attribute but@jklymak said it could be confusing asLinearSegmentedColormap doesn't have it. Then@timhoffm suggested using it. I am hoping that using it after specifically stating that it's onListedColormaps is a reasonable compromise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

maybe turn that into a section heading to make it more obvious?

timhoffm reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sectioning: The above should be something "Extracting values from a continuous colormap" (though technically most of the visually continous colormaps are still densely sampled ListedColormaps) and here "Extracting values from a discrete colormap".

I also suggest to not combine both theListedColormap.colors explanation and the therc_context into one plot. That's confusing. Either drop therc_context, or make it a separate plot.

@rcomer
Copy link
MemberAuthor

Renders like this

@rcomerrcomer added this to thev3.8-doc milestoneJan 26, 2024
Copy link
Member

@story645story645 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Small comments since this hasn't been merged yet.


For more details about manipulating colormaps, see :ref:`colormap-manipulation`.
Once we have hold of a `.Colormap` instance, individual colors can be accessed by
passing one or more floats or integers. For more details about manipulating colormaps,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
passingoneormorefloatsorintegers.Formoredetailsaboutmanipulatingcolormaps,
passingoneormorefloatsorintegers.Formoredetailsaboutmanipulatingcolormaps,

Sorry for the late review, but passing to what?



from cycler import cycler

cmap = mpl.colormaps.get_cmap('Dark2')
colors = cmap(range(cmap.N)) # cmap.N is number of unique colors in the colormap
colors = mpl.colormaps['Dark2'].colors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

maybe turn that into a section heading to make it more obvious?

timhoffm reacted with thumbs up emoji
Copy link
Member

@timhoffmtimhoffm left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sorry for leaving this hanging - too much to do.



from cycler import cycler

cmap = mpl.colormaps.get_cmap('Dark2')
colors = cmap(range(cmap.N)) # cmap.N is number of unique colors in the colormap
colors = mpl.colormaps['Dark2'].colors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sectioning: The above should be something "Extracting values from a continuous colormap" (though technically most of the visually continous colormaps are still densely sampled ListedColormaps) and here "Extracting values from a discrete colormap".

I also suggest to not combine both theListedColormap.colors explanation and the therc_context into one plot. That's confusing. Either drop therc_context, or make it a separate plot.

@rcomer
Copy link
MemberAuthor

Thanks@story645,@timhoffm.How's this?

@timhoffm
Copy link
Member

Thanks, this looks good! I would also say that@story645's comment is addressed, but let's give her the final word.

@story645
Copy link
Member

Awesome, thanks@rcomer !

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestFeb 4, 2024
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestFeb 4, 2024
story645 added a commit that referenced this pull requestFeb 4, 2024
…708-on-v3.8.2-docBackport PR#27708 on branch v3.8.2-doc (DOC: update colors from colormaps example)
story645 added a commit that referenced this pull requestFeb 4, 2024
…708-on-v3.8.xBackport PR#27708 on branch v3.8.x (DOC: update colors from colormaps example)
@rcomerrcomer deleted the color-from-cmap-2 branchFebruary 4, 2024 14:23
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@story645story645story645 left review comments

@timhoffmtimhoffmtimhoffm approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.8-doc
Development

Successfully merging this pull request may close these issues.

4 participants
@rcomer@timhoffm@story645@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp