hyperspy.drawing._markers.rectangle module¶
-
class
hyperspy.drawing._markers.rectangle.
Rectangle
(x1, y1, x2, y2, **kwargs)¶ Bases:
hyperspy.drawing.marker.MarkerBase
Rectangle marker that can be added to the signal figure
- Parameters
x1 (array or float) – The position of the up left corner of the rectangle 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.
y1 (array or float) – The position of the up left corner of the rectangle in y. see x1 arguments
x2 (array or float) – The position of the down right corner of the rectangle in x. see x1 arguments
y2 (array or float) – The position of the down right of the rectangle in y. see x1 arguments
kwargs – Keywords argument of axvline valid properties (i.e. recognized by mpl.plot).
Example
>>> import scipy.misc >>> im = hs.signals.Signal2D(scipy.misc.ascent()) >>> m = hs.plot.markers.rectangle(x1=150, y1=100, x2=400, y2=400, >>> color='red') >>> im.add_marker(m)
Adding a marker permanently to a signal
>>> im = hs.signals.Signal2D(np.random.random((50, 50)) >>> m = hs.plot.markers.rectangle(x1=20, y1=30, x2=40, y2=49) >>> im.add_marker(m, permanent=True)
-
update
()¶