hyperspy.drawing._widgets package¶
Submodules¶
hyperspy.drawing._widgets.circle module¶
hyperspy.drawing._widgets.horizontal_line module¶
-
class
hyperspy.drawing._widgets.horizontal_line.
HorizontalLineWidget
(axes_manager, **kwargs)¶ Bases:
hyperspy.drawing.widget.Widget1DBase
A draggable, horizontal line widget.
hyperspy.drawing._widgets.label module¶
-
class
hyperspy.drawing._widgets.label.
LabelWidget
(axes_manager)¶ Bases:
hyperspy.drawing.widget.Widget1DBase
A draggable text widget. Adds the attributes ‘string’, ‘text_color’ and ‘bbox’. These are all arguments for matplotlib’s Text artist. The default y-coordinate of the label is set to 0.9.
-
string
¶
-
hyperspy.drawing._widgets.line2d module¶
hyperspy.drawing._widgets.range module¶
-
class
hyperspy.drawing._widgets.range.
ModifiableSpanSelector
(ax, **kwargs)¶ Bases:
matplotlib.widgets.SpanSelector
-
contains
(mouseevent)¶
-
dummy
(*args, **kwargs)¶
-
mm_on_press
(event)¶
-
mm_on_release
(event)¶
-
move_left
(event)¶
-
move_rect
(event)¶
-
move_right
(event)¶
-
range
¶
-
release
(event)¶ When the button is realeased, the span stays in the screen and the iteractivity machinery passes to modify mode
-
set_initial
(initial_range=None)¶ Remove selection events, set the spanner, and go to modify mode.
-
switch_left_right
(x, left_to_right)¶
-
turn_off
()¶
-
update_range
()¶
-
-
class
hyperspy.drawing._widgets.range.
RangeWidget
(axes_manager)¶ Bases:
hyperspy.drawing.widget.ResizableDraggableWidgetBase
RangeWidget is a span-patch based widget, which can be dragged and resized by mouse/keys. Basically a wrapper for ModifiablepanSelector so that it conforms to the common widget interface.
For optimized changes of geometry, the class implements two methods ‘set_bounds’ and ‘set_ibounds’, to set the geomtry of the rectangle by value and index space coordinates, respectivly.
-
disconnect
()¶
-
set_bounds
(*args, **kwargs)¶ Set bounds by values. Bounds can either be specified in order left, bottom, width, height; or by keywords:
- ‘bounds’: tuple (left, width)
OR * ‘x’/’left’ * ‘w’/’width’, alternatively ‘right’ (x+w)
If specifying with keywords, any unspecified dimensions will be kept constant (note: width will be kept, not right).
-
set_ibounds
(*args, **kwargs)¶ Set bounds by indices. Bounds can either be specified in order left, bottom, width, height; or by keywords:
- ‘bounds’: tuple (left, width)
OR * ‘x’/’left’ * ‘w’/’width’, alternatively ‘right’
If specifying with keywords, any unspecified dimensions will be kept constant (note: width will be kept, not right).
-
set_on
(value)¶
-
-
hyperspy.drawing._widgets.range.
in_interval
(number, interval)¶
hyperspy.drawing._widgets.rectangles module¶
-
class
hyperspy.drawing._widgets.rectangles.
RectangleWidget
(axes_manager)¶ Bases:
hyperspy.drawing._widgets.rectangles.SquareWidget
,hyperspy.drawing.widget.ResizersMixin
RectangleWidget is a asymmetric, Rectangle-patch based widget, which can be dragged and resized by mouse/keys. For resizing by mouse, it adds a small Rectangle patch on the outer border of the main patch, to serve as resize handles. This feature can be enabled/disabled by the ‘resizers’ property, and the size/color of the handles are set by ‘resize_color’/’resize_pixel_size’.
For optimized changes of geometry, the class implements two methods ‘set_bounds’ and ‘set_ibounds’, to set the geomtry of the rectangle by value and index space coordinates, respectivly. It also adds the ‘width’ and ‘height’ properties for verbosity.
For keyboard resizing, ‘x’/’c’ and ‘y’/’u’ will increase/decrease the size of the rectangle along the first and the second axis, respectively.
Implements the internal method _validate_geometry to make sure the patch will always stay within bounds.
-
height
¶
-
on_key_press
(event)¶
-
set_bounds
(*args, **kwargs)¶ Set bounds by values. Bounds can either be specified in order left, bottom, width, height; or by keywords:
- ‘bounds’: tuple (left, top, width, height)
OR * ‘x’/’left’ * ‘y’/’top’ * ‘w’/’width’, alternatively ‘right’ (x+w) * ‘h’/’height’, alternatively ‘bottom’ (y+h)
If specifying with keywords, any unspecified dimensions will be kept constant (note: width/height will be kept, not right/bottom).
-
set_ibounds
(*args, **kwargs)¶ Set bounds by indices. Bounds can either be specified in order left, bottom, width, height; or by keywords:
- ‘bounds’: tuple (left, top, width, height)
OR * ‘x’/’left’ * ‘y’/’top’ * ‘w’/’width’, alternatively ‘right’ * ‘h’/’height’, alternatively ‘bottom’
If specifying with keywords, any unspecified dimensions will be kept constant (note: width/height will be kept, not right/bottom).
-
width
¶
-
-
class
hyperspy.drawing._widgets.rectangles.
SquareWidget
(axes_manager)¶ Bases:
hyperspy.drawing.widget.Widget2DBase
SquareWidget is a symmetric, Rectangle-patch based widget, which can be dragged, and resized by keystrokes/code. As the widget is normally only meant to indicate position, the sizing is deemed purely visual, but there is nothing that forces this use. However, it should be noted that the outer bounds only correspond to pure indices for odd sizes.
hyperspy.drawing._widgets.scalebar module¶
-
class
hyperspy.drawing._widgets.scalebar.
ScaleBar
(ax, units, pixel_size=None, color='white', position=None, max_size_ratio=0.25, lw=2, length=None, animated=False)¶ Bases:
object
-
calculate_line_position
(pad=0.05)¶
-
calculate_size
(max_size_ratio=0.25)¶
-
calculate_text_position
(pad=0.01)¶
-
get_units_string
()¶
-
plot_scale
(line_width=1)¶
-
remove
()¶
-
set_color
(c)¶
-
set_length
(length)¶
-
set_tex_bold
()¶
-
hyperspy.drawing._widgets.vertical_line module¶
-
class
hyperspy.drawing._widgets.vertical_line.
VerticalLineWidget
(axes_manager, **kwargs)¶ Bases:
hyperspy.drawing.widget.Widget1DBase
A draggable, vertical line widget.