hyperspy.drawing.image module

class hyperspy.drawing.image.ImagePlot

Bases: hyperspy.drawing.figure.BlittedFigure

Class to plot an image with the necessary machinery to update the image when the coordinates of an AxesManager change.

data_fuction

function or method – A function that returns a 2D array when called without any arguments.

pixel_units

{None, string} – The pixel units for the scale bar. Normally

scalebar, colorbar, plot_indices

bool

title

str – The title is printed at the top of the image.

vmin, vmax

float – Limit the range of the color map scale to the given values.

min_aspect

float – Set the minimum aspect ratio of the image and the figure. To keep the image in the aspect limit the pixels are made rectangular.

saturated_pixels

scalar – The percentage of pixels that are left out of the bounds. For example, the low and high bounds of a value of 1 are the 0.5% and 99.5% percentiles. It must be in the [0, 100] range.

centre_colormap

{“auto”, True, False} – If True the centre of the color scheme is set to zero. This is specially useful when using diverging color schemes. If “auto” (default), diverging color schemes are automatically centred.

axes_ticks
configure()
connect()
create_axis()
create_figure(max_size=None, min_size=2, **kwargs)

Create matplotlib figure

The figure size is automatically computed by default, taking into account the x and y dimensions of the image. Alternatively the figure size can be defined by passing the figsize keyword argument.

Parameters:
  • min_size (max_size,) – The maximum and minimum size of the axes in inches. These have no effect when passing the figsize keyword to manually set the figure size.
  • **kwargs – All keyword arguments are passed to plt.figure.
gui_adjust_contrast(display=True, toolkit=None)
Display widgets to adjust image contrast if available. Parameters ———- display: bool

If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

toolkit: str, iterable of strings or None

If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

on_key_press(event)
optimize_colorbar(number_of_ticks=5, tolerance=5, step_prec_max=1)
optimize_contrast(data)
plot(**kwargs)
scalebar
set_contrast(vmin, vmax)
update(**kwargs)
vmax
vmin