spyrit.misc.disp.imagesc
- spyrit.misc.disp.imagesc(Img, title='', colormap=None, show=False, figsize=None, fig=None, ax=None, cbar_pos=None, title_fontsize=16, **kwargs)[source]
Display image data with scaled colors, a colormap, and a colorbar, similar to MATLAB’s imagesc function.
This function acts as a wrapper around matplotlib.pyplot.imshow with custom handling for the colormap and colorbar placement.
- Args:
Img(array-like): The 2D array or image data to be displayed.title(str, optional): The title for the plot. Defaults to an empty string.colormap(str, int, or Colormap, optional): The colormap to use.If None (default), uses Matplotlib’s default ‘gray’ colormap.
If str, it should be a valid Matplotlib colormap name (e.g., ‘plasma’, ‘jet’, ‘viridis’).
If int or float, it is treated as a wavelength (in nm) and is passed to the function wavelength_to_colormap(colormap, gamma=0.6) from spyrit.misc.color to generate a custom colormap.
If a Matplotlib Colormap object, it is used directly.
show(bool, optional): If True (default), calls plt.show() to display the plot.figsize(tuple, optional): A tuple (width, height) specifying the figure size in inches. Passed to plt.figure(). Defaults to None.cbar_pos(str, optional): Position of the colorbar.If “bottom”, the colorbar is placed horizontally below the image.
If None (default) or any other value, the colorbar is placed vertically to the right of the image.
title_fontsize(int, optional): Font size for the plot title. Defaults to 16.**kwargs: Additional keyword arguments.
gamma(float, optional): The gamma correction factor when colormap is a wavelength (numeric). Defaults to 0.6.
- Returns:
None: The function primarily displays the plot via Matplotlib.