hyperspy.drawing._markers.point module

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

Bases: MarkerBase

Point marker that can be added to the signal figure.

If the signal has one or several navigation axes, the point marker can change as a function of the navigation position. This done by using an array for the x and y parameters. This array must have the same shape as the navigation axes of the signal.

  • 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 navigation axes.

  • y (array or float) – The position of the point in y. see x arguments

  • size (array or float, optional, default 20) – The size of the point. see x arguments

  • kwargs – Keyword arguments are passed to matplotlib.axes.Axes.scatter().


Add a marker with the same position for all navigation positions

>>> im = hs.signals.Signal2D(np.arange(1000).reshape([10, 10, 10]))
>>> m = hs.plot.markers.point(x=1, y=2, color='C0')
>>> s.add_marker(m)

Add a marker, the position of which depends on the navigation positions

>>> x_position = np.arange(10)
>>> y_position = np.arange(10) / 2
>>> m = hs.plot.markers.point(x=x_position, y=y_position, color='C1')
>>> s.add_marker(m)

Add a marker permanently; the marker is saved in the metadata

>>> im = hs.signals.Signal2D(np.random.random([10, 50, 50]))
>>> m = hs.plot.markers.point(10, 30, color='blue', size=50)
>>> im.add_marker(m, permanent=True)