Skip to content

DOC: Colormap tutorial needs info on manipulating colormaps #11903

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

Closed
jklymak opened this issue Aug 20, 2018 · 6 comments · Fixed by #11905
Closed

DOC: Colormap tutorial needs info on manipulating colormaps #11903

jklymak opened this issue Aug 20, 2018 · 6 comments · Fixed by #11905

Comments

@jklymak
Copy link
Member

jklymak commented Aug 20, 2018

Bug report

I don't see where in the documentation we help users know how to create or manipulate colormaps. Seems it should go here or in its own tutorial under colors:
https://matplotlib.org/tutorials/colors/colormaps.html#sphx-glr-tutorials-colors-colormaps-py

Crossref #7716

@jklymak jklymak added this to the v2.2-doc milestone Aug 20, 2018
@afvincent
Copy link
Contributor

There may be something here.

@jklymak
Copy link
Member Author

jklymak commented Aug 20, 2018

Great! Thanks, that should be in there too. OTOH it doesn't discuss ListedColormap which is a great way to make concatenated colormaps, so I think that needs documenation as well. But thanks, I made an issue because I wanted to make sure folks pointed me to stuff I was missing!

@afvincent
Copy link
Contributor

I am not saying that the current doc is enough for every use case: TBH I never really understood it ^^.

@jklymak
Copy link
Member Author

jklymak commented Aug 20, 2018

... I understand it, but not well enough to not have to look it up everytime I need to make a colormap. Which is good, because it means I spend very little time making tweaked colormaps 😛

@anntzer
Copy link
Contributor

anntzer commented Aug 21, 2018

Looking at #7716 again, truncation is basically just e.g.

cmap = colors.ListedColormap(plt.cm.viridis(np.linspace(.3, .7, 256)))

and concatenation

cmap = colors.ListedColormap(np.vstack([
    plt.cm.viridis(np.linspace(0, .5, 50)),
    plt.cm.jet(np.linspace(.5, 1, 50)),
]))

with much more lines spent doing input checking/massaging than anything else, so I now agree that we may just want to better document this.
(This doesn't take care of over/under/bad, but neither does #7716...)

@jklymak
Copy link
Member Author

jklymak commented Aug 22, 2018

WRT https://matplotlib.org/gallery/images_contours_and_fields/custom_cmap.html, I took a crack at improving the explanation in #11905. If its actually better, I'd suggest we rewrite custom_cmap and also add a short ListedColormap example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants