Repository navigation
Very WIP: sequential colors for plot_compare_evoked - #4221
jona-sassenhagen wants to merge 11 commits into
Conversation
|
|
||
| norm = mpl.colors.BoundaryNorm(numbers + [numbers[-1] +1], l.N) | ||
| sm = matplotlib.cm.ScalarMappable(cmap=l, norm=norm | ||
| ) |
There was a problem hiding this comment.
a lonely bracket, lost in the code, help it find its way home!
There was a problem hiding this comment.
That whole chunk of code is just very terrible in general ... I don't dare fixing it yet.
There was a problem hiding this comment.
But you've given some hope to the lonely bracket now ;)
|
@mmagnuski do you think you can test it a bit? |
|
I don't get where the error is coming from: |
|
@jona-sassenhagen I'll see if I can fix it |
|
|
||
| Returns | ||
| ------- | ||
| Returns |
There was a problem hiding this comment.
How the hell did that show up here!?
Thanks Eric. I was combing through the parts I could remember changing, but couldn't find anything.
There was a problem hiding this comment.
FWYW on a somewhat related note I find that checking my own diffs top-to-bottom on GitHub I usually find one or two things I didn't mean to put in there or forgot to change. I usually try to do it before requesting a review, as it cuts down on the review iteration cycles/time a bit.
There was a problem hiding this comment.
Ha, this isn't ready for review yet, first I have to see if I can convince @agramfort to allow all of the clumsy magic for the sake of a convenience plotting function.
Codecov Report
|
|
Sadly this is adding like 2 secs to the tests. |
|
Error is just coverage ... @agramfort did you have time to look at the API (see gist)? |
|
@jona-sassenhagen Yes, I can test later today. I'll let you know. |
|
Thanks @mmagnuski ... I don't mean 'stress testing', just if you find the function useful and the API sensible. |
|
When I set sequential to False in the last cell it breaks. To me it's too much magic. I would go with a more explicit approach, maybe inspired by pandas or seaborn. inferring variables from strings (keys here) is for me very much like black magic. |
|
So a design matrix-like approach? How about: (E.g. a dict mapping conditions to integers, where the integers indicate color on a colormap) The API needs the split legend though. Though I think this can be as easy as directly mapping the linestyles dict to a legend. One also needs to set the colorbar label though, somehow. E.g., minimally, here
|
|
let's draft the different use cases: First a 2/2 design: then a mix of categorical and continuous: or using meta @jona-sassenhagen please edit this so we have a compact view of what use case we want to support |
|
@jona-sassenhagen sorry for the delay, it works well for me but I tested only simple cases with one sequential var. I like the |
|
@agramfort something changed the post as I was editing and I lost all my comments, so I'm putting it here ... Factorial: Continuous
Mixed: (Mixed would depend on 1. giving a Mixed by order: (Currently, evokeds can be either 1. an Evoked obj, 2. a list of evoked objs, 3. a dict of evoked objs, 4. a list of lists of evoked objs, 5. a dict of lists of evoked objs.) Right now I'm not sure the "dict of dicts" approach we discussed would be such a good idea. I think your 'meta' idea would be better for something where we allow more flexibility (e.g., seaborn which has hue, col, row, marker, ...). But here we only ever have two: color and linestyle. Right? |
|
@jona-sassenhagen fine with the proposal except I don't like the: cmap = {"colorbar_label":"jet"} cmap should be None, str or an instance of plt.cm.XXX so ok for cmap = 'jet' so colors and linestyles cannot be dict if evoked is not a dict. If evoked is a dict then everything is a dict and we use HED last thing, how do you specify what to show in the legend? |
|
sorry @jona-sassenhagen I was not notified of your edit of the previous message. I don't understand why you say that the mixed use case will not work. My summary is: List input for Continuous
then we use evokeds as dict: Factorial: and then mixed if one of the value in the color dict is not a string. Mixed: it means that what is not color coded with an int does not generate a colorbar. clear? do I miss something? |
|
I don't understand why you say that the mixed use case will not work.
I only meant that for
linestyles = ["-", ":", "-", ":"]
colors = [1, 1, 2, 2]
you don't know what the labels for the linestyle legend should be. So you'd have to omit the legend.
I'm fine with it as is otherwise, although this
evokeds = {'A/1': evoked1, 'A/2': evoked2, 'B/1': evoked3, 'B/2': evoked4}
colors = {"1":1, "2":2}
cmap = {"colorbar_label":"jet"}
mne.viz.plot_compare_evokeds(evokeds, colors=colors, cmap=cmap)
would mean you'd get a lot of
colors = {cond.split("/")[-1]:int(cond.split("/")[-1]) for cond in evokeds}
which would be a bit redundant.
|
|
I only meant that for
linestyles = ["-", ":", "-", ":"]
colors = [1, 1, 2, 2]
you don't know what the labels for the linestyle legend should be. So
you'd have to omit the legend.
ok use all condition attributes as legend so you would have 4 entries in
legend.
I'm fine with it as is otherwise, although this
evokeds = {'A/1': evoked1, 'A/2': evoked2, 'B/1': evoked3, 'B/2': evoked4}
colors = {"1":1, "2":2}
cmap = {"colorbar_label":"jet"}
mne.viz.plot_compare_evokeds(evokeds, colors=colors, cmap=cmap)
would mean you'd get a lot of
colors = {cond.split("/")[-1]:int(cond.split("/")[-1]) for cond in
evokeds}
which would be a bit redundant.
I don't see (yet?) the problem.
sounds like we have a plan. Unfortunately my 1,5 day of potential coding is
over
so we need volunteer or this will wait...
|
|
sounds like we have a plan. Unfortunately my 1,5 day of potential coding is
over
so we need volunteer or this will wait...
What do you mean, I'll do it :) I need this code.
|
|
Ok I'm back at this since #4289 looks like it'll get merged soon. |
|
tell me when it's not "Very WIP" anymore :)
|
|
Closed for #4526 |
PR early, PR often.
See
http://nbviewer.jupyter.org/gist/jona-sassenhagen/b1fca57f72e36b8c225d0315b18a0206