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
[MRG+1] Contour levels to colorbar. #3797
Conversation
Warning: it is possible, and often desirable, to set 0 contour levels. Wouldn't this then mean you have no units on the colorbar? Otherwise, you're a beast! |
Then it only shows the zero, but maybe this should also show |
I'm not sure which is the best way to do this. Opinions? |
Current coverage is 86.38% (diff: 92.30%)@@ master #3797 diff @@
==========================================
Files 343 343
Lines 61271 61292 +21
Methods 0 0
Messages 0 0
Branches 9381 9384 +3
==========================================
+ Hits 52929 52948 +19
- Misses 5625 5626 +1
- Partials 2717 2718 +1
|
Make it an alternative option IMO. |
This made me realize that the contour levels aren't actually same for all the images. |
I also think this shouldn't be the default. For multiple topomaps contour levels would have to be forced to be the same... BTW - how does it look like if you do it the other way: instead of forcing colorbar ticks to be where the contour lines are, force contour lines to be where colorbar ticks have been set? |
Yeah, that's what I'm looking at now. Trying to find out how mpl does it. I don't want the contours to set to something like 166.6666666. |
I don't remember ever seeing mpl setting ticks to such weird values. :) But you can access the tick locators in ticker module. I've never played with these classes though... |
That looks quite good IMO! A somewhat more far-fetched idea, could similar tech be used to threshold certain t score maps by significance levels eventually ..? |
Probably. I don't know the stats package that well. This changes the contour levels a little bit as can be seen from the pictures, but I suppose it's okay since the threshold levels were not previously visible anyway. |
Looks good! |
LGTM |
if isinstance(contours, int): | ||
from matplotlib import ticker | ||
# nbins = ticks - 1, since 2 of the ticks are vmin and vmax, the | ||
# correct number of bins equals to contours + 1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"equals contours + 1" or "is equal to contours +1"
f9b4486
to
6833b0c
Compare
LGTM can someone else have a look so @jaeilepp can have his +2? |
I will once I'm within wireless range again.
|
Sorry to come late, but I actually think that showing the max/min and all the contour levels is cleanest. Even if it's not evenly spaced it's most informative in terms of what everything means in the plot |
Yeah that does look bad, and if it's fairly common that it happens then it's not worth it. I suspect it wouldn't be too difficult to come up with a heurestic for when to include hte vmin/vmax based on where the other contours are, but that can be another PR if someone gets bored. LGTM, @jona-sassenhagen feel free to merge if you're happy |
Yeah, I would have thought that there would have been an option for this in mpl's locator, but I couldn't find one that works. |
6833b0c
to
eddb067
Compare
So we're still set on not having this as a parameter-accessible option? It's gonna become the new default? |
I'm voting for this as a default. The other options would be more or less arbitrary values. |
I think this should be accessible through a keyword arg... ( |
It's not easily user-changeable, isn't it? Which would mean it should be settable with a kwarg. But I see your point @jaeilepp that the current method is arbitrary and maybe it's not so good to set "arbitrary" as a param. |
Actually, |
I like the fact that |
what do you suggest? is this good for you to merge?
|
My suggestion (and Jona's) was to add a keyword argument that allows to turn off this behavior, but make it default. @jaeilepp - would that be ok? |
@mmagnuski can we add that once we hit a use case that needs it? Or do you already know there will be? |
@Eric89GXL sure, I've played with it a bit now and I no longer think that colorbar will get messy for a reasonable number of contour levels. :) |
so you give your +1?
|
Well it has my +1 :D Tried it, looks good. |
Yes, 👍 from me too :) |
Thanks @jaeilepp |
Thanks @jaeilepp ! |
Thanks @jaeilepp !! |
Closes #3795
The colorbars are so small by default, that I had to make the tick labels a bit smaller.