-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
700e656
commit 6d48bd8
Showing
4 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# --- | ||
# jupyter: | ||
# jupytext: | ||
# text_representation: | ||
# extension: .py | ||
# format_name: sphinx | ||
# format_version: '1.1' | ||
# jupytext_version: 1.10.2 | ||
# kernelspec: | ||
# display_name: Python 3 | ||
# language: python | ||
# name: python3 | ||
# --- | ||
|
||
""" | ||
.. _exa-utsstat: | ||
UTS-statistics plot (``UTSStat``) | ||
================================= | ||
""" | ||
# sphinx_gallery_thumbnail_number = 3 | ||
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) | ||
|
||
ds.summary() | ||
|
||
############################################################################### | ||
# Plot the mean and SEM of all trials. | ||
|
||
p = plot.UTSStat('cz', ds=ds, frame='t') | ||
|
||
############################################################################### | ||
# Split within and between plots. | ||
|
||
p = plot.UTSStat('cz', 'cloze_cat', 'length', ds=ds, frame='t') | ||
|
||
############################################################################### | ||
# Colors can also be set using the within-plot category only. | ||
|
||
colors = plot.colors_for_oneway(['high', 'low']) | ||
p = plot.UTSStat("cz", 'cloze_cat', 'length', ds=ds, colors=colors, frame='t', legend=False) | ||
legend = plot.ColorList(colors) | ||
|
||
############################################################################### | ||
# Plot all categories in the same plot. Make lines more distinguishable through line-style. | ||
|
||
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", 'cloze_cat % length', ds=ds, colors=colors, frame='t') |