eelbrain.plot.UTSStat

class eelbrain.plot.UTSStat(y, x=None, xax=None, match=None, sub=None, ds=None, main=<function mean>, error='sem', pool_error=None, legend=None, labels=None, axtitle=True, xlabel=True, ylabel=True, xticklabels='bottom', yticklabels='left', invy=False, bottom=None, top=None, case=None, xdim=None, xlim=None, clip=None, colors=None, error_alpha=0.3, mask=None, clusters=None, pmax=0.05, ptrend=0.1, **kwargs)

Plot statistics for a one-dimensional NDVar

Parameters
  • y (Union[NDVar, str, Sequence[Union[NDVar, str]]]) – One or several dependent variable(s) (one-dimensional NDVar).

  • x (Union[Factor, Interaction, NestedEffect, str, None]) – Model: specification of conditions which should be plotted separately.

  • xax (Union[Factor, Interaction, NestedEffect, str, None]) – Make separate axes for each category in this categorial model.

  • match (Union[Factor, Interaction, NestedEffect, str, None]) – Identifier for repeated measures data.

  • sub (Union[Var, ndarray, str, None]) – Only use a subset of the data provided.

  • ds (Optional[Dataset]) – If a Dataset is specified, all data-objects can be specified as names of Dataset variables.

  • main (func | None) – Measure for the central tendency (function that takes an axis argument). The default is numpy.mean.

  • error (Union[str, Callable]) – Measure of variability to plot. Examples: sem: Standard error of the mean; 2sem: 2 standard error of the mean; ci: 95% confidence interval; 99%ci: 99% confidence interval; sd: standard deviation; all: Show all traces; none: No variability indication.

  • pool_error (Optional[bool]) – Pool the errors for the estimate of variability (default is True for related measures designs, False otherwise). See Loftus & Masson (1994).

  • legend (Union[str, int, Tuple[float, float], bool, None]) – Matplotlib figure legend location argument or ‘fig’ to plot the legend in a separate figure.

  • labels (Optional[Dict[Union[str, Tuple[str, ...]], str]]) – Alternative labels for legend as {cell: label} dictionary (preserves order).

  • axtitle (Union[bool, Sequence[str]]) – Title for the individual axes. The default is to show the names of the epochs, but only if multiple axes are plotted.

  • xlabel (Union[bool, str]) – X-axis label. By default the label is inferred from the data.

  • ylabel (Union[bool, str]) – Y-axis label. By default the label is inferred from the data.

  • xticklabels (Union[str, int, Sequence[int]]) – Specify which axes should be annotated with x-axis tick labels. Use int for a single axis, a sequence of int for multiple specific axes, or one of 'left' | 'bottom' | 'all' | 'none'.

  • yticklabels (Union[str, int, Sequence[int]]) – Specify which axes should be annotated with y-axis tick labels. Use int for a single axis, a sequence of int for multiple specific axes, or one of 'left' | 'bottom' | 'all' | 'none'.

  • invy (bool) – Invert the y axis (if bottom and/or top are specified explicitly they take precedence; an inverted y-axis can also be produced by specifying bottom > top).

  • bottom (Optional[float]) – The lower end of the plot’s y axis.

  • top (Optional[float]) – The upper end of the plot’s y axis.

  • case (Optional[str]) – Dimension to treat as case (default is 'case').

  • xdim (Optional[str]) – Dimension to plot along the x-axis (default is 'time')

  • xlim (Union[float, Tuple[float, float], None]) – Initial x-axis view limits as (left, right) tuple or as length scalar (default is the full x-axis in the data).

  • clip (Optional[bool]) – Clip lines outside of axes (the default depends on whether frame is closed or open).

  • color (matplotlib color) – Color if just a single category of data is plotted.

  • colors (Optional[Dict[Union[str, Tuple[str, ...]], Any]]) – Colors for the plots if multiple categories of data are plotted. str: A colormap name; Cells of x are mapped onto the colormap in regular intervals. list: A list of colors in the same sequence as x.cells. dict: A dictionary mapping each cell in x to a color. Colors are specified as matplotlib compatible color arguments.

  • error_alpha (float) – Alpha of the error plot (default 0.3).

  • mask (NDVar | {cell: NDVar}) – Mask certain time points. To control appearance of masked regions, set colors using plot.Style.

  • clusters (Optional[Dataset]) – Clusters to add to the plots. The clusters should be provided as Dataset, as stored in test results’ clusters.

  • pmax (float) – Maximum p-value of clusters to plot as solid.

  • ptrend (float) – Maximum p-value of clusters to plot as trend.

  • tight – Use matplotlib’s tight_layout to expand all axes to fill the figure (default True)

  • title – Figure title.

  • ... – Also accepts General layout parameters.

Examples

Notes

Navigation:
  • : scroll up

  • : scroll down

  • r: y-axis zoom in (reduce y-axis range)

  • c: y-axis zoom out (increase y-axis range)

Examples

Single NDVar from a Dataset:

plot.UTSStat('uts', 'A', 'B', match='rm', ds=ds)

Multiple NDVar in different axes

plot.UTSStat([‘uts1’, ‘uts2’], ‘A’, match=’rm’, ds=ds)

Multiple NDVar in a single axes:

plot.UTSStat([['uts1', 'uts2']], match=True, ds=ds)

Methods

add_hline(y[, axes])

Draw a horizontal line on one or more axes

add_hspan(bottom, top[, axes])

Draw a horizontal bar on one or more axes

add_vline(x[, axes])

Draw a vertical line on one or more axes

add_vspan(xmin, xmax[, axes])

Draw a vertical bar on one or more axes

add_vspans(intervals[, axes])

Draw vertical bars over axes

close()

Close the figure.

draw()

(Re-)draw the figure (after making manual changes).

draw_crosshairs([enable])

Draw crosshairs under the cursor

draw_outline([color])

Draw the outline of the figure

get_xlim()

get_ylim()

image([name, format, close])

Create FMTXT Image from the figure

plot_legend([loc, labels])

Plot the legend (or remove it from the figure).

save(*args, **kwargs)

Short-cut for Matplotlib's savefig()

save_legend(*args, **kwargs)

Save the legend as image file

set_clusters(clusters[, pmax, ptrend, ...])

Add clusters from a cluster test to the plot (as shaded area).

set_name(name)

Set the figure window title

set_xlabel(label[, ax])

Set the label for the x-axis

set_xlim([left, right])

Set the x-axis limits for all axes

set_xtick_rotation(rotation)

Rotate every x-axis tick-label by an angle (counterclockwise, in degrees)

set_ylabel(label[, ax])

Set the label for the y-axis

set_ylim([bottom, top])

Set the y-axis limits