eelbrain.plot.LineStack

class eelbrain.plot.LineStack(y, x=None, sub=None, ds=None, offset='y.max() - y.min()', ylim=None, xlim=None, xlabel=True, xticklabels=True, ylabel=True, order=None, colors=None, ylabels=True, xdim=None, legend=None, labels=None, clip=None, *args, **kwargs)

Stack multiple lines vertically

Parameters:
y : NDVar

Values to plot.

x : cateorial

Variable to aggregate cases into lines (default is to plot each line).

sub : None | index array

Only use a subset of the data provided.

ds : None | Dataset

If a Dataset is specified, all data-objects can be specified as names of Dataset variables.

offset : float | str

The distance between the baseline (y = 0) for the different lines. Can be a string expressed as a function of y. For example, '0.66 * max(y)' will offset each line by 0.66 times the maximum value in y (after aggregating if x is specified). The default is '2/3 * max(y.max(), -y.min())'.

xlim : scalar | (scalar, scalar)

Initial x-axis view limits as (left, right) tuple or as length scalar (default is the full x-axis in the data).

xlabel : bool | str

X-axis label. By default the label is inferred from the data.

xticklabels : bool

Print x-axis tick-labels (set to False to suppress them).

ylabel : bool | str

Y-axis label. By default the label is inferred from the data.

colors : dict | sequence of colors

Colors for the lines (default is all lines in black).

ylabels : bool | dict | sequence of str

Labels for the different lines, placed along the y-axis.

legend : str | int | ‘fig’ | None

Matplotlib figure legend location argument or ‘fig’ to plot the legend in a separate figure.

labels : dict

Alternative labels for legend as {cell: label} dictionary (preserves order).

clip : bool

Clip lines outside of axes (the default depends on whether frame is closed or open).

Also accepts General layout parameters.

Notes

Navigation:
  • : scroll left
  • : scroll right
  • home: scroll to beginning
  • end: scroll to end
  • f: x-axis zoom in (reduce x axis range)
  • d: x-axis zoom out (increase x axis range)

Methods

add_hline(self, y[, axes]) Draw a horizontal line on one or more axes
add_hspan(self, bottom, top[, axes]) Draw a horizontal bar on one or more axes
add_vline(self, x[, axes]) Draw a vertical line on one or more axes
add_vspan(self, xmin, xmax[, axes]) Draw a vertical bar on one or more axes
add_vspans(self, intervals[, axes]) Draw vertical bars over axes
close(self) Close the figure.
draw(self) (Re-)draw the figure (after making manual changes).
draw_crosshairs(self[, enable]) Draw crosshairs under the cursor
get_xlim(self)
image(self[, name, format]) Create FMTXT Image from the figure
plot_legend(self[, loc, labels]) Plot the legend (or remove it from the figure).
save(self, *args, **kwargs) Short-cut for Matplotlib’s savefig()
save_legend(self, *args, **kwargs) Save the legend as image file
set_name(self, name) Set the figure window title
set_xlabel(self, label[, ax]) Set the label for the x-axis
set_xlim(self[, left, right]) Set the x-axis limits for all axes
set_xtick_rotation(self, rotation) Rotate every x-axis tick-label by an angle (counterclockwise, in degrees)
set_ylabel(self, label[, ax]) Set the label for the y-axis