mvpa2.viz.matshow

mvpa2.viz.matshow(matrix, xlabel_attr=None, ylabel_attr=None, numbers=None, **kwargs)

Enhanced version of matplotlib’s matshow().

This version is able to handle datasets, and label axis according to dataset attribute values.

>>> from mvpa2.viz import matshow
>>> from mvpa2.misc.data_generators import normal_feature_dataset
>>> ds = normal_feature_dataset(10, 2, 18, 5)
>>> im = matshow(ds, ylabel_attr='targets', xlabel_attr='chunks',
...               numbers='%.0f')
Parameters:

matrix : 2D array

The matrix that is to be plotted as an image. If ‘matrix’ is of type Dataset the function tries to plot the corresponding samples.

xlabel_attr : str or None

If not ‘None’ matrix is treated as a Dataset and labels are extracted from the sample attribute named ‘xlabel_attr’. The labels are used as the ‘x_tick_lables’ of the image.

ylabel_attr : str or None

If not ‘None’ matrix is treated as a Dataset and labels are extracted from the feature attribute named ‘ylabel_attr’. The labels are used as the ‘y_tick_lables’ of the image.

numbers : dict, str or None

If not ‘None’ plots matrix values as text inside the image. If a string is provided, then this string is used as format string. In case that a dictionary is provided, the dictionary gets passed on to the text command, and, ‘%d’ is used to format the values.

**kwargs :

Additional parameters passed on to matshow().

Returns:

matplotlib.AxesImage :

Handler for the created image.