stimupy.utils.plotting#
Functions#
Plot a stimulus |
|
Plot multiple stimuli |
|
Plots visual comparison of two image-arrays |
- plot_stim(stim, mask=False, stim_name='stim', ax=None, vmin=0, vmax=1, save=None, units='deg', origin='mean')[source]#
Plot a stimulus
Plots the stimulus-array (key: “img”) directly from stim dict. Optionally also plots mask.
- Parameters:
stim (dict) – stimulus dict containing stimulus-array (key: “img”)
mask (bool or str, optional) – If True, plot mask on top of stimulus image (default: False). If string is provided, plot this key from stimulus dictionary as mask
stim_name (str, optional) – Stimulus name used for plotting (default: “stim”)
ax (Axis object, optional) – If not None (default), plot in the specified Axis object
vmin (float, optional) – Minimal intensity value for plotting. The default is 0.
vmax (float, optional) – Minimal intensity value for plotting. The default is 1.
save (None or str, optional) – If None (default), do not save the plot. If string is provided, save plot under this name.
units ("px", "deg" (default), or str) – what units to put on the axes, by default degrees visual angle (“deg”). If a str other than “deg”(/”degrees”) or “px”(/”pix”/”pixels”) is passed, it must be the key to a tuple in stim
- Returns:
ax – If ax was passed and plotting is None, returns updated Axis object.
- Return type:
Axis object
- plot_stimuli(stims, mask=False, vmin=0, vmax=1, save=None, units='deg')[source]#
Plot multiple stimuli
Plots the stimulus-arrays (keys: “img”) directly from stim dicts. Arranges stimuli in a grid. Optionally also plots masks.
- Parameters:
stims (dict of dicts) – dictionary composed of stimulus dicts containing stimulus-array (key: “img”)
mask (bool or str, optional) – If True, plot mask on top of stimulus image (default: False). If string is provided, plot this key from stimulus dictionary as mask
vmin (float, optional) – Minimal intensity value for plotting. The default is 0.
vmax (float, optional) – Minimal intensity value for plotting. The default is 1.
save (None or str, optional) – If None (default), do not save the plot. If string is provided, save plot under this name.
units ("px", "deg" (default), or str) – what units to put on the axes, by default degrees visual angle (“deg”). If a str other than “deg”(/”degrees”) or “px”(/”pix”/”pixels”) is passed, it must be the key to a tuple in stim
- plot_comparison(original_img, new_img)[source]#
Plots visual comparison of two image-arrays
- Parameters:
original_img (numpy.ndarray) – original image-array
new_img (numpy.ndarray) – new image-array
- Returns:
Figure containing plots of images, and their comparison(s)
- Return type:
matplotlib.Figure