hyperspy.drawing._markers package

Submodules

hyperspy.drawing._markers.horizontal_line module

class hyperspy.drawing._markers.horizontal_line.HorizontalLine(y, **kwargs)

Bases: hyperspy.drawing.marker.MarkerBase

Horizontal line marker that can be added to the signal figure

Parameters:
  • y (array or float) – The position of the line. If float, the marker is fixed. If array, the marker will be updated when navigating. The array should have the same dimensions in the nagivation axes.
  • kwargs – Kewywords argument of axvline valid properties (i.e. recognized by mpl.plot).

Example

>>> import numpy as np
>>> s = hs.signals.Signal1D(np.random.random([10, 100])) * 10
>>> m = hs.plot.markers.horizontal_line(y=range(10), color='green')
>>> s.add_marker(m)
plot()
update()

hyperspy.drawing._markers.horizontal_line_segment module

class hyperspy.drawing._markers.horizontal_line_segment.HorizontalLineSegment(x1, x2, y, **kwargs)

Bases: hyperspy.drawing.marker.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 nagivation 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 – Kewywords argument of axvline valid properties (i.e. recognized by mpl.plot).

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)
plot()
update()

hyperspy.drawing._markers.line_segment module

class hyperspy.drawing._markers.line_segment.LineSegment(x1, y1, x2, y2, **kwargs)

Bases: hyperspy.drawing.marker.MarkerBase

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 nagivation axes.
  • y1 (array or float) – The position of the start of the line segment in y. see x1 arguments
  • x2 (array or float) – The position of the end of the line segment in x. see x1 arguments
  • y2 (array or float) – The position of the end of the line segment in y. see x1 arguments
  • kwargs – Kewywords argument of axvline valid properties (i.e. recognized by mpl.plot).

Example

>>> im = hs.signals.Signal2D(np.zeros((100, 100)))
>>> m = hs.plot.markers.line_segment(
>>>     x1=20, x2=70, y1=20, y2=70,
>>>     linewidth=4, color='red', linestyle='dotted')
>>> im.add_marker(m)
plot()
update()

hyperspy.drawing._markers.point module

class hyperspy.drawing._markers.point.Point(x, y, size=20, **kwargs)

Bases: hyperspy.drawing.marker.MarkerBase

Point marker that can be added to the signal figure

Parameters:
  • x (array or float) – The position of the point 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 nagivation axes.
  • y (array or float) – The position of the point in y. see x arguments
  • size (array or float) – The size of the point. see x arguments
  • kwargs – Kewywords argument of axvline valid properties (i.e. recognized by mpl.plot).

Example

>>> im = hs.signals.Signal2D(np.random.random([10, 50, 50]))
>>> m = hs.plot.markers.point(x=range(10), y=range(10)[::-1],
                                 color='red')
>>> im.add_marker(m)

#Markers on local maxima >>> from skimage.feature import peak_local_max >>> import scipy.misc >>> im = hs.signals.Signal2D(scipy.misc.ascent()).as_signal2D([2,0]) >>> index = array([peak_local_max(i.data, min_distance=100, num_peaks=4) >>> for i in im]) >>> for i in range(4): >>> m = hs.plot.markers.point(x=index[:, i, 1], >>> y=index[:, i, 0], color=’red’) >>> im.add_marker(m)

plot()
update()

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 nagivation 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 – Kewywords 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)
plot()
update()

hyperspy.drawing._markers.text module

class hyperspy.drawing._markers.text.Text(x, y, text, **kwargs)

Bases: hyperspy.drawing.marker.MarkerBase

Text marker that can be added to the signal figure

Parameters:
  • x (array or float) – The position of the text 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 nagivation axes.
  • y (array or float) – The position of the text in y. see x arguments
  • text (array or str) – The text. see x arguments
  • kwargs – Kewywords argument of axvline valid properties (i.e. recognized by mpl.plot).

Example

>>> s = hs.signals.Signal1D(np.arange(100).reshape([10,10]))
>>> s.plot(navigator='spectrum')
>>> for i in range(10):
>>>     m = hs.plot.markers.text(y=range(50,1000,100)[i],
>>>                                 x=i, text='abcdefghij'[i])
>>>     s.add_marker(m, plot_on_signal=False)
>>> m = hs.plot.markers.text(x=5, y=range(7,110, 10),
>>>                             text=[i for i in 'abcdefghij'])
>>> s.add_marker(m)
plot()
update()

hyperspy.drawing._markers.vertical_line module

class hyperspy.drawing._markers.vertical_line.VerticalLine(x, **kwargs)

Bases: hyperspy.drawing.marker.MarkerBase

Vertical line marker that can be added to the signal figure

Parameters:
  • x (array or float) – The position of the line. If float, the marker is fixed. If array, the marker will be updated when navigating. The array should have the same dimensions in the nagivation axes.
  • kwargs – Kewywords argument of axvline valid properties (i.e. recognized by mpl.plot).

Example

>>> import numpy as np
>>> s = hs.signals.Signal1D(np.random.random([10, 100]))
>>> m = hs.plot.markers.vertical_line(x=range(10), color='green')
>>> s.add_marker(m)
plot()
update()

hyperspy.drawing._markers.vertical_line_segment module

class hyperspy.drawing._markers.vertical_line_segment.VerticalLineSegment(x, y1, y2, **kwargs)

Bases: hyperspy.drawing.marker.MarkerBase

Vertical line segment marker that can be added to the signal figure

Parameters:
  • x (array or float) – The position of 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 nagivation axes.
  • y1 (array or float) – The position of the start of the line segment in x. see x1 arguments
  • y2 (array or float) – The position of the start of the line segment in y. see x1 arguments
  • kwargs – Kewywords argument of axvline valid properties (i.e. recognized by mpl.plot).

Example

>>> import numpy as np
>>> im = hs.signals.Signal2D(np.zeros((100, 100)))
>>> m = hs.plot.markers.vertical_line_segment(
>>>     x=20, y1=30, y2=70, linewidth=4, color='red', linestyle='dotted')
>>> im.add_marker(m)
plot()
update()

Module contents