FIX: proper channel-type-specific vmin/vmax in topo image plots#6230
FIX: proper channel-type-specific vmin/vmax in topo image plots#6230massich merged 9 commits intomne-tools:masterfrom
Conversation
|
|
||
| def plot_topo_image_epochs(epochs, layout=None, sigma=0., vmin=None, | ||
| vmax=None, colorbar=True, order=None, cmap='RdBu_r', | ||
| vmax=None, colorbar=None, order=None, cmap='RdBu_r', |
There was a problem hiding this comment.
You changed default value of colorbar in a public function but did not update its docstring. (see code-guidelines, to know more about mne-docstring conventions).
| if colorbar is None: | ||
| colorbar = (len(set(ch_types)) == 1) | ||
| if colorbar and vmin is None and vmax is None: | ||
| vmin, vmax = vlim_array[0] |
There was a problem hiding this comment.
This chunk is really large. Consider breaking it down with existing functions or add some comments describing the workflow. Keep the amount comments to as few as possible, also consider if factoring the code with functions.
mne/viz/topo.py
Outdated
| @@ -853,23 +857,44 @@ def plot_topo_image_epochs(epochs, layout=None, sigma=0., vmin=None, | |||
| ------- | |||
| fig : instance of matplotlib.figure.Figure | |||
There was a problem hiding this comment.
I know our policy says "avoid unnecessary cosmetic changes in PRs", but since you're already changing this docstring, could you add a cross-reference to mne.Epochs and matplotlib.figure.Figure here?
There was a problem hiding this comment.
OK, I also will add one for matplotlib.pyplot.imshow OK?
mne/viz/topo.py
Outdated
| Display or not a colorbar. | ||
| colorbar : bool | None | ||
| Display or not a colorbar. If ``None`` (the default) a colorbar will be | ||
| shown only if all channels are of the same type. |
There was a problem hiding this comment.
When chenging the default you could do a pass so that all of them follow the recomended starnad. That shows the default at the end. here are some examples:
- colorbar : bool | None
- Display or not a colorbar. If ``None`` (the default) a colorbar will be
- shown only if all channels are of the same type.
+ colorbar : bool | None
+ Display or not a colorbar. If ``None`` a colorbar will be
+ shown only if all channels are of the same type. Defaults to ``None``- show : bool
- Show figure if True.
+ show : Bool
+ Weather to show the figure or not. Defaults to ``True``.| colorbar : bool | ||
| Display or not a colorbar. | ||
| colorbar : bool | None | ||
| Whether to display a colorbar or not. If ``None`` a colorbar will be |
There was a problem hiding this comment.
Instead of a colorbar please use the colorbar because there is always only one.
There was a problem hiding this comment.
Also, since you introduced the quoting in the docstring (None), do it consistently everywhere.
mne/viz/topo.py
Outdated
| The color of tick labels in the colorbar. Defaults to white. | ||
| show : bool | ||
| Show figure if True. | ||
| Whether to show the figure. Defaults to True. |
|
OK @massich I think this is ready to go. |
Codecov Report
@@ Coverage Diff @@
## master #6230 +/- ##
==========================================
+ Coverage 87.3% 89.02% +1.72%
==========================================
Files 413 414 +1
Lines 74559 74799 +240
Branches 12301 12351 +50
==========================================
+ Hits 65094 66592 +1498
+ Misses 6594 5302 -1292
- Partials 2871 2905 +34 |
|
@drammock thx for making the CIs green again. But you introduced this new behaviour for You can check coverage of pytest --cov=mne.viz.topo --cov-report=term-missing mne/viz/tests/test_topo.pyfrom the mne-python root directory. Also, a reminder that you can run all tests locally using pytest mne/or just a single test by doing: pytest mne/path/to/test_foo.py -k name_of_test_i_have_modified |
|
OK @massich I've added a test that hits the new lines. |
|
Thx, @drammock |
closes #6112
color limits on
epochs.plot_topo_image()are messed up. Example code:Results on current master (note the same colorbar limits on the 2 popups)
overview plot
popup plot (magnetometer)
popup plot (gradiometer)
Results after this PR (note the different colorbars on the 2 popups)
overview plot
popup plot (magnetometer)
popup plot (gradiometer)