amep.plot.draw_arrow#

amep.plot.draw_arrow(fig, x: float, y: float, dx: float, dy: float, **kwargs)#

Draws an arrow on a Matplotlib figure.

This function uses the FancyArrow class to draw an arrow on a Matplotlib figure at a specified position, with a given displacement. The arrow is added directly to the figure object.

Parameters:
  • fig (matplotlib.figure.Figure) – The Matplotlib figure object on which the arrow will be drawn.

  • x (float) – The starting x-coordinate of the arrow, in figure coordinates (0 to 1).

  • y (float) – The starting y-coordinate of the arrow, in figure coordinates (0 to 1).

  • dx (float) – The horizontal displacement (change in x) of the arrow, in figure coordinates.

  • dy (float) – The vertical displacement (change in y) of the arrow, in figure coordinates.

  • **kwargs – Additional keyword arguments passed to matplotlib.patches.FancyArrow, such as color, width, head_width, and head_length.

Return type:

None.

Notes

The arrow’s position and size are specified in figure coordinates. Figure coordinates range from 0 to 1, where (0, 0) represents the bottom-left corner and (1, 1) represents the top-right corner of the figure.

Examples

>>> fig, axs = amep.plot.new(figsize=(3, 3))
>>> x=0.2
>>> y=0.2
>>> dx=0.5
>>> dy=0.5
>>> amep.plot.draw_arrow(
...     fig, x, y, dx, dy, color="blue", alpha=0.8, width=0.05,
...     head_width=0.1, head_length=0.03
... )
>>>