-
Notifications
You must be signed in to change notification settings - Fork 34
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
Plotting connectivity matrices with both negative and positive values should change default colorbar #248
Comments
There is precedent with things like
How do people feel about adding similar behaviour to But @JohannesWiesner, could the code you show not be replaced with just passing |
Sounds good to me! |
@JohannesWiesner Would you be able to open a PR for this? |
@tsbinns : This has two problems. 1.) I think it would be good if the value 0 always is the same as the "facecolor" argument, so that connections with the value 0 blend in with the background. Therefore the function has to know what the background color is and then build a colorscale taking this information into account 2.) If you're distribution is skewed, setting "RdBu_r" will not result in a colorscale that matches See (this is what happens if you only set "RdBu_r"): |
I would say this is a matter of personal preference, and possibly something already accomodated for by exposing the @larsoner already agreed that if data has both negative and positive values, the
Ah, I thought there was some logic in place to account for this. If negative and positive values are present, I also think it makes sense that the 'neutral' colour (i.e., the middle of the diverging colormap) is centered around zero. This could already be done by specifying |
@tsbinns : Asked this question on Stackoverflow, maybe there is a generic way to customize a default colormap instead of building one from scratch: |
Cool, would be interested to see. I came across one convenient way, but I don't know how generalisable this is across different ways of creating the colourbar. In any case for the connectivity visualisation with divergent colourbars, some logic to center it around zero would be a nice feature. |
Maybe it would also make sense to open another issue? Wouldn't it make more sense to set the background color by default to white and the text color by default to black? Because this is closer to what users would also copy and paste into their text editors / poster editors? From there on, it would make more sense to think about good default colormaps for positive-only and positive-and-negative connectivity matrices? |
Good point. In case of the latter, it might probably become necessary that the function can accept a |
I agree with #248 (comment) that auto-choosing (which I guess means we should make that function public, if we're going to use it here). I think it would be too strict to always force the center of a two-slope colormap to be the same as the facecolor. Seems like a nice clear docs example is the best solution, maybe also a note in the Notes section of the docstring. Here's a good starting point: |
Okay, but based off of that example, this means there is also room to add a |
yeah sorry I meant to say that explicitly. Adding |
So @JohannesWiesner, is this something you are able to create a PR for at this time? Or is there also some help we can offer? |
I don't have time for this at the moment, but maybe over the Christmas holidays. Just a quick sanity check: if the matrix data is normally distributed, shouldn't a On top, I would still pitch for a default white background with black text. In that case, |
There's no rush from our end. Unfortunately I would also not have time to work on this before January, but if there's still work to be done then I am happy to try lend a hand!
If by normally distributed you mean centered around zero, I think yes.
I think the hangup here would be that this represents a change in behaviour that could disrupt people's existing code. Currently if you would pass
So again here, updating default behaviour like this would require a deprecation cycle. Also as mentioned above, forcing zero values to match the background colour is a bit strict. I agree that the ERD example linked to covers this nicely. Something similar could be done in an example here to show how plotting can be customised to personal preferences. |
If your issue is a usage question, please consider asking on the
MNE Forum instead of opening an issue.
Describe the problem
The default colormap for mne-connectivity.viz.plot_connectivity_circle is "hot". This colorscale only makes sense for positive values. However, my matrix contains both positive and negative values. In this case the colormap should change to a diverging map with two different colors mapping to positive and negative values (e.g. blue to red with black in the middle). 0s should correspond to the background color.
Describe your solution
I currently do this:
The text was updated successfully, but these errors were encountered: