hyperspy.drawing.signal1d module

class hyperspy.drawing.signal1d.Signal1DFigure(title='', **kwargs)

Bases: BlittedFigure

add_line(line, ax='left', connect_navigation=False)

Add Signal1DLine to figure

Parameters:
  • line (Signal1DLine object) – Line to be added to the figure.

  • ax ({'left', 'right'}, optional) – Position the y axis, either ‘left’. The default is ‘left’.

  • connect_navigation (bool, optional) – Connect the update of the line to the indices_changed event of the axes_manager. This only necessary when adding a line to the left since the indices_changed event is already connected to the update method of Signal1DFigure. The default is False.

Return type:

None.

close_right_axis(adjust_layout=True)

Remove the axis on the right hand side of the figure

Parameters:

adjust_layout (bool, optional) – Whether to call plt.tight_layout or not. The default is True.

Return type:

None.

create_right_axis(color='black', adjust_layout=True)

Add an axis on the right hand side of the figure.

Parameters:

adjust_layout (bool, optional) – Whether to call plt.tight_layout or not. The default is True.

Return type:

None.

update()

Update lines, markers and render at the end. This method is connected to the indices_changed event of the axes_manager.

class hyperspy.drawing.signal1d.Signal1DLine

Bases: object

Line that can be added to Signal1DFigure.

type

Select the line drawing style.

Type:

{‘scatter’, ‘step’, ‘line’}

line_properties

Accepts a dictionary of valid (i.e. recognized by mpl.plot) containing valid line properties. In addition it understands the keyword type that can take the following values: {‘scatter’, ‘step’, ‘line’}

Type:

dictionary

auto_update

If False, executing _auto_update_line does not update the line plot.

Type:

bool

set_line_properties()

Enables setting the line_properties attribute using keyword arguments.

Raises:

ValueError – If an invalid keyword value is passed to line_properties.

_auto_update_line(update_ylimits=False, **kwargs)

Updates the line plot only if auto_update is True.

This is useful to connect to events that automatically update the line.

update(force_replot=False, render_figure=True, update_ylimits=False)

Update the current spectrum figure

Parameters:
  • force_replot (bool) – If True, close and open the figure. Default is False.

  • render_figure (bool) – If True, render the figure. Useful to avoid firing matplotlib drawing events too often. Default is True.

  • update_ylimits (bool) – If True, update the y-limits. This is useful to avoid the figure flickering when different lines update the y-limits consecutively, in which case, this is done in Signal1DFigure.update. Default is False.