[Mne_analysis] Plot multiple raw objects

Dan McCloy dan at mccloy.info
Fri Jul 24 12:52:46 EDT 2020
Search archives:

        External Email - Use Caution        

Hi Alexandra,

Raw.plot() is intended primarily as an interactive data browser (with scrollbars, lots of keyboard shortcuts, etc), which is why it does not permit plotting into a pre-defined axes object. One rather tedious workaround is to use matplotlib interactive mode (`import matplotlib.pyplot as plt; plt.ion()`) and then open two plotting windows (one for unfiltered data, the other for filtered data) and go back and forth between them to keep scrolling/scaling/etc. in sync between the two windows.

Another approach would be to pre-determine the channels/time windows you want to compare, set up a for-loop to cycle through those views of the data one at a time, and on each loop iteration, pop open two raw.plot() windows (one filtered, one unfiltered). That avoids the tedious back-and-forth of scrolling two windows together, in exchange for a bit more coding up front.

Note that Raw.plot() already supports toggling projectors on and off within a given plot window; in principle it would be possible to also allow toggling filters on and off too, but it's not yet implemented. I'm in the midst of a large refactoring of the Raw.plot() code right now, so such a feature wouldn't get added until that is finished, but feel free to open an issue (https://github.com/mne-tools/mne-python/issues/new/choose) for that feature request if you think it is something you would use frequently. Be sure to describe your use case in detail (i.e., is plotting into existing axes what you really care about? Would interactive toggling of filters within a single window be adequate/worse/better? etc).
-- dan
Daniel McCloy
https://dan.mccloy.info
Research Scientist
Institute for Learning and Brain Sciences
University of Washington

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, July 24, 2020 6:23 AM, Aleksandra Pestka <aleksandra.anna.pestka at gmail.com> wrote:

> External Email - Use Caution
>
> Hello,
>
> Is it possible to visualize multiple datasets at once using mne.io.RawArray.plot method or any other?
>
> My goal is to compare data in time domain before and after filtering. Making subplots is not a solution for me.
> I've noticed that I cannot pass axes as an argument to mne.io.RawArray.plot just like in mne.io.RawArray.plot_psd function.
>
> I'll be grateful for any advice.
>
> Best,
> Alexandra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200724/385e92c9/attachment.html 


More information about the Mne_analysis mailing list