.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plots/utsstat.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plots_utsstat.py: .. _exa-utsstat: UTS-statistics (plot.UTSStat) ============================= .. GENERATED FROM PYTHON SOURCE LINES 22-32 .. code-block:: Python # sphinx_gallery_thumbnail_number = 5 from eelbrain import * ds = datasets.simulate_erp(snr=1) # add an orthogonal variable ds['length'] = Factor(ds['n_chars'] > 4, labels={True: 'long', False: 'short'}) # smooth the data to make plots nicer ds['cz'] = ds["eeg"].sub(sensor='Cz').smooth('time', 0.05) .. GENERATED FROM PYTHON SOURCE LINES 33-34 Plot the mean and SEM by condition: .. GENERATED FROM PYTHON SOURCE LINES 34-37 .. code-block:: Python p = plot.UTSStat('cz', 'predictability', data=ds, axh=3) .. image-sg:: /auto_examples/plots/images/sphx_glr_utsstat_001.png :alt: utsstat :srcset: /auto_examples/plots/images/sphx_glr_utsstat_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 38-39 Split between different axes and use a ``t``-frame: .. GENERATED FROM PYTHON SOURCE LINES 39-42 .. code-block:: Python p = plot.UTSStat('cz', 'predictability', 'length', data=ds, frame='t', axh=2) .. image-sg:: /auto_examples/plots/images/sphx_glr_utsstat_002.png :alt: long, short :srcset: /auto_examples/plots/images/sphx_glr_utsstat_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 43-44 Colors can also be set using the within-plot category only: .. GENERATED FROM PYTHON SOURCE LINES 44-49 .. code-block:: Python colors = plot.colors_for_oneway(['high', 'low']) p = plot.UTSStat("cz", 'predictability', 'length', data=ds, colors=colors, frame='t', legend=False, axh=2) legend = plot.ColorList(colors) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/plots/images/sphx_glr_utsstat_003.png :alt: long, short :srcset: /auto_examples/plots/images/sphx_glr_utsstat_003.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/plots/images/sphx_glr_utsstat_004.png :alt: utsstat :srcset: /auto_examples/plots/images/sphx_glr_utsstat_004.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 50-51 Plot all categories in the same plot. Make lines more distinguishable through line-style: .. GENERATED FROM PYTHON SOURCE LINES 51-60 .. code-block:: Python colors = { ('high', 'long'): plot.Style((1, 0, 0)), ('high', 'short'): plot.Style((1, 0.5, 0.5), linestyle='--'), ('low', 'long'): plot.Style((0, 0, 1)), ('low', 'short'): plot.Style((0.5, 0.5, 1), linestyle='--'), } p = plot.UTSStat("cz", 'predictability % length', data=ds, colors=colors, frame='t', top=1e-6, axh=3) .. image-sg:: /auto_examples/plots/images/sphx_glr_utsstat_005.png :alt: utsstat :srcset: /auto_examples/plots/images/sphx_glr_utsstat_005.png :class: sphx-glr-single-img .. _sphx_glr_download_auto_examples_plots_utsstat.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: utsstat.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: utsstat.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: utsstat.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_