hyperspy.drawing._widgets.label module

class hyperspy.drawing._widgets.label.LabelWidget(axes_manager, color='black', **kwargs)

Bases: Widget1DBase

A draggable text widget. Adds the attributes ‘string’ and ‘bbox’. These are all arguments for matplotlib’s Text artist. The default y-coordinate of the label is set to 0.9.


on mouse motion draw the cursor if picked


Create the matplotlib patch(es), and store it in self.patch


Sets the position of the widget (by values). The dimensions should correspond to that of the ‘axes’ attribute. Calls _pos_changed if the value has changed, which is then responsible for triggering any relevant events.


Updates the position of the patch on the plot.


Validates the passed position. Depending on the position and the implementation, this can either fire a ValueError, or return a modified position that has valid values. Or simply return the unmodified position if everything is ok.

This default implementation bounds the position within the axes limits.