-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[DO NOT MRG] plot_compare_evoked improved line colouring #4526
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
[DO NOT MRG] plot_compare_evoked improved line colouring #4526
Conversation
|
@mmagnuski can you eventually check if the API works for you? I remember your ICON poster |
Codecov Report
@@ Coverage Diff @@
## master #4526 +/- ##
==========================================
- Coverage 87.85% 87.79% -0.07%
==========================================
Files 349 349
Lines 65819 66194 +375
Branches 11319 11503 +184
==========================================
+ Hits 57826 58112 +286
- Misses 5119 5186 +67
- Partials 2874 2896 +22 |
|
I propose to complete this once we have metadata in + kword file in datasets. This gist will make an amazing tutorial ! really nice @jona-sassenhagen 👍 |
|
Yeah, makes sense. We can in fact reproduce the full analysis in Dufau, Grainger, ... 2015 in a few lines of code with MNE. I'd like to demonstrate how to use the cluster correction, cause it seems to confuse many newcomers, but is very hip in ERPland these days. |
|
@jona-sassenhagen can you rebase? what's left to do here? |
|
Well you said:
? |
|
Or do you just mean the tutorial. |
|
my bad.... forget it...
|
e4e73cb to
73b4c10
Compare
|
Eric, try the plot_metadata_epochs tutorial with this :) |
|
Can you rebase and touch the tutorial to make circle do the work?
|
|
I just did both - is there anything wrong? |
|
Oh god, there are tons of errors. |
|
You need to make some change (even a trivial rewrite / typo fix) |
|
Oh I see, I had those changes locally, but they were not pushed after the rebase (I assume because they were not changed by the original PR).
|
|
Nice! I would separate the last two plots into separate sections so they appear full-size |
|
CircleCI doesn't have |
|
Oh wow, we are green, but I need to rebase from my own 2-line PR. :| |
|
I am sure you will survive...
|
14b6b29 to
cb7fd1c
Compare
|
@jona-sassenhagen once it comes back can you check CircleCI and post a link? |
|
I will try :D |
|
I get the same for my local Python 2.7 :( |
|
Time to work on those debugging skills |
|
BTW - is the legend a parasite axis (or something like this)? They are much harder to customize (change position etc.), I thinkI had this problem with plot_joint in the past. |
|
It's an |
|
Oh nice. We are green. |
|
Any chance we can get this merged before tomorrow morning? :) |
tutorials/plot_metadata_epochs.py
Outdated
| @@ -1,4 +1,6 @@ | |||
| """ | |||
| .. _tut_metadata_epochs: | |||
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.
don't add this, there is a standard ref tag automagically inserted based on filename sphx_glr_auto_tutorials_plot_metadata_epochs.py
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.
Ugh, how did this end up there? Must have come with the rebase or something. I didn't do it manually.
tutorials/plot_visualize_evoked.py
Outdated
| # We plot a MEG channel with a strong auditory response. | ||
| # | ||
| # For move advanced plotting using :func:`mne.viz.plot_compare_evokeds` | ||
| # see also :ref:`tut_metadata_epochs`. |
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.
This too - I didn't put it here.
Should the line be changed? @larsoner
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.
@agramfort did:
It's fine to leave the new sentences but remove the _tut_ ref and replace it with the standard one. You can check correctness locally with cd doc/; make html_dev-noplot, you should only see 5 (I think?) warnings about gallery images missing in manual/.
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.
Oh ok.
larsoner
left a comment
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.
Other than my minor gripes LGTM, but I don't fully appreciate/understand all the use cases, so @mmagnuski I'll rely on your judgment here
mne/viz/evoked.py
Outdated
| if colors is None: | ||
| raise ValueError( | ||
| "If `split_legend` is True, `colors` must not be None.") | ||
| import matplotlib.lines as mlines |
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.
let's move this to the top of the function so the nested imports / namespace is clear
mne/viz/evoked.py
Outdated
| ax_cb.set_xticks(()) | ||
| ax_cb.set_ylabel(cmap_label) | ||
| fig.cbar = ax_cb | ||
| fig.ts_ax = axes |
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.
I would prefer to avoid figure.axes cause we have a varying number of axes.
But based on when it's created it should always be the last axis of the figure. It seems cleaner/more standard to get it as figure.axes[-1].
|
There, very green. |
|
@jona-sassenhagen I'll take a look this evening, be patient! :) |
|
Thanks @mmagnuski ! |
mne/viz/evoked.py
Outdated
| if ci is True: | ||
| ci = .95 | ||
| elif ci is not False and not (isinstance(ci, np.float) or callable(ci)): | ||
| raise TypeError('ci must be float or callable, got ' + str(type(ci))) |
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.
nitpick: "ci must be None, bool, float or callable ..."
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.
Addressed, merge if you want.
| for n_letters in letters: | ||
| evokeds[n_letters] = epochs["NumberOfLetters == " + n_letters].average() | ||
|
|
||
| style_plot["colors"] = {n_letters: int(float(n_letters)) |
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.
I like how colors are created now, as a side not the int(float(n_letters)) would not be necessary if NumberOfLetters in metadata was of int type.
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.
Yes, I probably should have done it like that.
mmagnuski
left a comment
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.
Very cool, wholeheartedly approve!
|
This already got at least +3 so far so I'll go ahead and merge. |
|
Thanks everyone for reviews! |
|
The travis build timed out ... restarted. |
|
codecov now complains, but previously all was green. My understanding of codecov is quite limited (I am often confused by why for the same PR one time it is green and another it compains) - so I refer to your intuitions @jona-sassenhagen @larsoner. |
|
@mmagnuski don't merge. I spend a significant of time yesterday to simplify this code. see #4755 let me know If I miss some commits there and If none I'll close this PR |


Redo of #4221
Good for parametric and complex factorial designs.
See gist