mvpa2.viz.hist¶
-
mvpa2.viz.
hist
(dataset, xgroup_attr=None, ygroup_attr=None, xlim='same', ylim='same', noticks=False, **kwargs)¶ Compute and draw feature histograms (for groups of samples)
This is a convenience wrapper around matplotlib’s hist() function. It supports it entire API, but data is taken from an input dataset. In addition, feature histograms for groups of dataset samples can be drawn as an array of subplots. Using
xgroup_attr
andygroup_attr
up to two sample attributes can be selected and samples groups are defined by their unique values. For example, plotting histograms for all combinations oftargets
andchunks
attribute values in a dataset is done by this code:>>> from mvpa2.viz import hist >>> from mvpa2.misc.data_generators import normal_feature_dataset >>> ds = normal_feature_dataset(10, 3, 10, 5) >>> plots = hist(ds, ygroup_attr='targets', xgroup_attr='chunks', ... noticks=None, xlim=(-.5,.5), normed=True) >>> len(plots) 15
This function can also be used with plain arrays, in which case it will fall back on the behavior of matplotlib’s hist() and additional functionality is not available.
Parameters: dataset : Dataset or array
xgroup_attr : string, optional
Name of a samples attribute to be used as targets
ygroup_attr : None or string, optional
If a string, a histogram will be plotted per each target and each chunk (as defined in sa named
chunks_attr
), resulting is a histogram grid (targets x chunks).xlim : None or 2-tuple or ‘same’, optional
Common x-axis limits for all histograms. By default all plots will have the same range of values. Set to None if you would like to let them vary.
ylim : None or 2-tuple or ‘same’, optional
Common y-axis limits for all histograms. If same, heights for all histograms will be made equal depending on the data.
noticks : bool or None, optional
If True, no axis ticks will be plotted. If False, each histogram subplot will have its own ticks. If None, only the outer subplots will have ticks. This is useful to save space in large plots, but should be combined with
xlim
andylim
arguments in order to ensure equal axes across subplots.**kwargs :
Any additional arguments are passed to matplotlib’s hist().
Returns: list :
List of figure handlers for all generated subplots.