hyperspy.drawing._markers.horizontal_line_segment module
- class hyperspy.drawing._markers.horizontal_line_segment.HorizontalLineSegment(x1, x2, y, **kwargs)
Bases:
MarkerBase
Horizontal line segment marker that can be added to the signal figure
- Parameters:
x1 (array or float) – The position of the start of the line segment in x. If float, the marker is fixed. If array, the marker will be updated when navigating. The array should have the same dimensions in the navigation axes.
x2 (array or float) – The position of the end of the line segment in x. see x1 arguments
y (array or float) – The position of line segment in y. see x1 arguments
kwargs – Keywords arguments are passed to
matplotlib.axes.Axes.hlines()
.
Example
>>> im = hs.signals.Signal2D(np.zeros((100, 100))) >>> m = hs.plot.markers.horizontal_line_segment( >>> x1=20, x2=70, y=70, linewidth=4, color='red', linestyle='dotted') >>> im.add_marker(m)
Adding a marker permanently to a signal
>>> im = hs.signals.Signal2D(np.zeros((100, 100))) >>> m = hs.plot.markers.horizontal_line_segment( >>> x1=10, x2=30, y=42, linewidth=4, color='red', linestyle='dotted') >>> im.add_marker(m, permanent=True)