Table Of Contents

Previous topic

misc.param

Next topic

misc.plot.erp

misc.plot.base

Module: misc.plot.base

Misc. plotting helpers.

Functions

mvpa.misc.plot.base.inverseCmap(cmap_name)
Create a new colormap from the named colormap, where it got reversed
mvpa.misc.plot.base.plotBars(data, labels=None, title=None, ylim=None, ylabel=None, width=0.20000000000000001, offset=0.20000000000000001, color='0.6', distance=1.0, yerr='ste', **kwargs)

Make bar plots with automatically computed error bars.

Candlestick plot (multiple interleaved barplots) can be done, by calling this function multiple time with appropriatly modified offset argument.

Parameters:
  • data (array (nbars x nobservations) | other sequence type) – Source data for the barplot. Error measure is computed along the second axis.
  • labels (list | None) – If not None, a label from this list is placed on each bar.
  • title (str) – An optional title of the barplot.
  • ylim (2-tuple) – Y-axis range.
  • ylabel (str) – An optional label for the y-axis.
  • width (float) – Width of a bar. The value should be in a reasonable relation to distance.
  • offset (float) – Constant offset of all bar along the x-axis. Can be used to create candlestick plots.
  • color (matplotlib color spec) – Color of the bars.
  • distance (float) – Distance of two adjacent bars.
  • yerr (‘ste’ | ‘std’ | None) – Type of error for the errorbars. If None no errorbars are plotted.
  • **kwargs – Any additional arguments are passed to matplotlib’s bar() function.
mvpa.misc.plot.base.plotDatasetChunks(ds, clf_labels=None)

Quick plot to see chunk sctructure in dataset with 2 features

if clf_labels is provided for the predicted labels, then incorrectly labeled samples will have ‘x’ in them

mvpa.misc.plot.base.plotErrLine(data, x=None, errtype='ste', curves=None, linestyle='--', fmt='o', perc_sigchg=False, baseline=None)

Make a line plot with errorbars on the data points.

Parameters:
  • data (sequence of sequences) – First axis separates samples and second axis will appear as x-axis in the plot.
  • x (sequence) – Value to be used as ‘x-values’ corresponding to the elements of the 2nd axis id data. If None, a sequence of ascending integers will be generated.
  • errtype (‘ste’ | ‘std’) – Type of error value to be computed per datapoint. ‘ste’: standard error of the mean ‘std’: standard deviation
  • curves (None | list of tuple(x, y)) – Each tuple represents an additional curve, with x and y coordinates of each point on the curve.
  • linestyle (str) – matplotlib linestyle argument. Applied to either the additional curve or a the line connecting the datapoints. Set to ‘None’ to disable the line completely.
  • fmt (str) – matplotlib plot style argument to be applied to the data points and errorbars.
  • perc_sigchg (bool) – If True the plot will show percent signal changes relative to a baseline.
  • baseline (float | None) – Baseline used for converting values into percent signal changes. If None and perc_sigchg is True, the absolute of the mean of the first feature (i.e. [:,0]) will be used as a baseline.
Make dataset with 20 samples from a full sinus wave period,
computed 100 times with individual noise pattern.
  >>> x = N.linspace(0, N.pi * 2, 20)
  >>> data = N.vstack([N.sin(x)] * 30)
  >>> data += N.random.normal(size=data.shape)
Now, plot mean data points with error bars, plus a high-res
version of the original sinus wave.
  >>> x = N.linspace(0, N.pi * 2, 200)
  >>> plotErrLine(data, curves=[(x, N.sin(x))])
  >>> #P.show()
mvpa.misc.plot.base.plotFeatureHist(dataset, xlim=None, noticks=True, perchunk=False, **kwargs)

Plot histograms of feature values for each labels.

Parameters:
  • dataset (Dataset) –
  • xlim (None | 2-tuple) – Common x-axis limits for all histograms.
  • noticks (boolean) – If True, no axis ticks will be plotted. This is useful to save space in large plots.
  • perchunk (boolean) – If True, one histogramm will be plotted per each label and each chunk, resulting is a histogram grid (labels x chunks).
  • **kwargs – Any additional arguments are passed to matplotlib’s hist().
mvpa.misc.plot.base.plotSamplesDistance(dataset, sortbyattr=None)

Plot the euclidean distances between all samples of a dataset.

Parameters:
  • dataset (Dataset) – Providing the samples.
  • sortbyattr (None | str) – If None, the samples distances will be in the same order as their appearance in the dataset. Alternatively, the name of a samples attribute can be given, which wil then be used to sort/group the samples, e.g. to investigate the similarity samples by label or by chunks.