sqfa.plot
Utilities for plotting data, model parameters and geometry.
- sqfa.plot.draw_color_bar(colormap, limits, fig, title=None)
Draw a color bar for the given colormap and limits.
- Parameters:
colormap (str or matplotlib.colors.Colormap) – The colormap to use.
limits (list) – The minimum and maximum values for the color scale.
fig (matplotlib.figure.Figure) – The figure to draw the color bar on.
- Returns:
color_bar – The created color bar.
- Return type:
ColorbarBase
- sqfa.plot.scatter_data(data, labels, ax=None, values=None, dim_pair=(0, 1), n_points=1000, classes_plot=None, legend_type='none', **kwargs)
Plot scatter of the data to different categories.
- Parameters:
data (torch.Tensor) – Responses to the stimuli. Shape (n_stimuli, n_filters).
labels (torch.int64) – Class labels of each point with shape (n_points).
ax (matplotlib.axes.Axes, optional) – Axes to plot the scatter. If None, a new figure is created. The default is None.
values (torch.Tensor, optional) – Values to color the classes. The default is linearly spaced values between -1 and 1.
dim_pair (tuple, optional) – Pair of filters to plot. The default is (0, 1).
n_points (int, optional) – Number of points per class to plot. The default is 1000.
classes_plot (list, optional) – List of classes to plot. The default is all classes.
legend_type (str, optional) – Type of legend to add: ‘none’, ‘continuous’, ‘discrete’.
- Returns:
ax – Axes with the scatter plot.
- Return type:
matplotlib.axes.Axes
- sqfa.plot.statistics_ellipses(ellipses, centers=None, dim_pair=(0, 1), ax=None, values=None, classes_plot=None, color_map='viridis', legend_type='none', **kwargs)
Plot the ellipses of the filter response statistics across classes.
- Parameters:
ellipses (torch.Tensor) – Shape of ellipses as SPD matrices. Shape (n_classes, n_dim, n_dim).
centers (torch.Tensor) – Centers of ellipses. Shape (n_classes, n_dim).
dim_pair (tuple of int, optional) – Pair of filters to plot. The default is [0, 1].
ax (matplotlib.axes.Axes, optional) – Axes to plot the ellipses. If None, a new figure is created. The default is None.
values (torch.Tensor, optional) – Values to color code the ellipses. Each value corresponds to a class. Default is [0:n_classes].
classes_plot (list, optional) – List of classes to plot. The default is all classes.
color_map (str or matplotlib.colors.Colormap, optional) – Color map to use for the ellipses. The default is ‘viridis’.
legend_type (str, optional) – Type of legend to add: ‘none’, ‘continuous’, ‘discrete’. The default is ‘none’.
**kwargs – Additional arguments to pass to the legend.
- Returns:
ax – Axes with the scatter plot.
- Return type:
matplotlib.axes.Axes
Modules
Functions for working with colors and colormaps. |
|
Scatter data of different classes with color code. |
|
Plot ellipses. |