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

What is the default colormap for windrose? #35

Closed
cqcn1991 opened this issue Jul 12, 2016 · 4 comments · Fixed by #198
Closed

What is the default colormap for windrose? #35

cqcn1991 opened this issue Jul 12, 2016 · 4 comments · Fixed by #198

Comments

@cqcn1991
Copy link

This is the plot I get using windrose,

qq

I notice that in https://github.com/scls19fr/windrose/blob/a024d3af097c69d28f98328e7eb2b3dbc215838a/windrose/windrose.py , there is not cmap for bar. Then I want to know, how to change the colormap of it?

Addtionally, is it jet? Will it be changed according to Matplotlib update? (http://matplotlib.org/style_changes.html)

@scls19fr
Copy link
Member

Hi @cqcn1991

I'm really impressed by your work !

Sorry but I don't know what it will happen with Matplotlib update...

If no cmap argument is passed it might be jet
https://github.com/scls19fr/windrose/blob/a024d3af097c69d28f98328e7eb2b3dbc215838a/windrose/windrose.py#L243

You might try to pass cmap argument (different than jet) to both bar and windrose
if only windrose take account of this cmap argument... than a PR to fix will be very nice

@cqcn1991
Copy link
Author

cqcn1991 commented Jul 13, 2016

Just tried it

# Not work
ax.bar(df.dir_windrose, df.speed, normed=True, opening=0.8, edgecolor='white', nsector=36, cmap='viridis')
# Works
viridis = plt.get_cmap('viridis')
ax.bar(df.dir_windrose, df.speed, normed=True, opening=0.8, edgecolor='white', nsector=36, cmap=viridis)

2016-07-13 08 51 06

From https://github.com/scls19fr/windrose/blob/a024d3af097c69d28f98328e7eb2b3dbc215838a/windrose/windrose.py#L242 , I can see that it's not string name but the cmap itself get passed. Not sure if this is a good design.

I find the cmap=plt.get_cmap(name) from http://matplotlib.org/examples/color/colormaps_reference.html

@scls19fr
Copy link
Member

I think it's better to pass cmap itself and not its name because you can be able to pass a custom cmap (a user defined cmap that don't have name) this way.

@cqcn1991
Copy link
Author

cqcn1991 commented Jul 13, 2016

@scls19fr OK. I post this issue because I just know that matplotlib is changing colormap from jet to viridis, and I think you maybe interested in it as well. If you are unfamiliar with this, you can see discussion here (http://matplotlib.org/style_changes.html) and here (http://stats.stackexchange.com/questions/223315/why-use-colormap-viridis-over-jet).

Addtionally, thanks for your intereste in https://github.com/cqcn1991/Wind-Speed-Analysis. Could you tell me where it interest you most? Honestly, while I open-sourced this project (It's my Master Thesis, and I'm working a paper on it), I never know any other people would care about it.

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

Successfully merging a pull request may close this issue.

2 participants