Skip to content
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

tab-completion for interactivity? #1

Closed
amueller opened this issue Dec 1, 2016 · 5 comments
Closed

tab-completion for interactivity? #1

amueller opened this issue Dec 1, 2016 · 5 comments

Comments

@amueller
Copy link

amueller commented Dec 1, 2016

This is a usability question. It looks to me like all the colormaps are available via the cc.cm dictionary. However, there is no auto-complete for dictionaries in jupyter notebook, so I either need to remember the name exactly and type it out, or call cm.keys(), search for the colormap, and copy and paste the string.

Maybe there's an easier way that I don't see?

If I could use jupyters auto-complete to find the right color map, that would be much easier given your naming schemes. One way to achieve that would be to make cm be a bunch object, so that the items can be obtained with __get_attr__. If you define __dir__ right, that allows tab-completion.
You could also define a sub-module that has instances of the colormaps with appropriate names (I think that's what matplotlib does?)

Thanks for these great colormaps!

@jbednar
Copy link
Member

jbednar commented Dec 13, 2016

Sorry; I didn't get a notice of this question when it came in! I tried to make all the colormaps available in several different ways to make them convenient to use in different contexts. If you import colorcet, all the colormaps should autocomplete already in the colorcet namespace:

image

(Here the "m_" prefix gives you the matplotlib colormaps, while "b_" (or no prefix at all, for the short names like "fire") will give Bokeh palettes.) But I'd be happy to accept a pull request to define __get_attr__ and __dir__ to work for cc.cm, if that helps anyone!

@jbednar
Copy link
Member

jbednar commented Dec 13, 2016

(And if someone happens to get that in today :-), it would make it in time for the new release scheduled for tomorrow; otherwise it will be in the subsequent one.)

@amueller
Copy link
Author

ah, cool. is that documented? That totally solves my issue. I just didn't find it.

@jbednar
Copy link
Member

jbednar commented Dec 22, 2016

Good point; it was not well documented, but hopefully it is now: https://bokeh.github.io/colorcet/#Accessing-the-colormaps

@jbednar jbednar closed this as completed Dec 22, 2016
@amueller
Copy link
Author

thanks!

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

No branches or pull requests

2 participants