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.
- _onmousemove(event)
on mouse motion draw the cursor if picked
- _set_patch()
Create the matplotlib patch(es), and store it in self.patch
- _set_position(position)
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.
- _update_patch_position()
Updates the position of the patch on the plot.
- _validate_pos(pos)
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.