On this page
matplotlib.pyplot.arrow
matplotlib.pyplot.arrow(x, y, dx, dy, hold=None, **kwargs)-
Add an arrow to the axes.
Draws arrow on specified axis from (
x,y) to (x+dx,y+dy). Uses FancyArrow patch to construct the arrow.Parameters: x : float
X-coordinate of the arrow base
y : float
Y-coordinate of the arrow base
dx : float
Length of arrow along x-coordinate
dy : float
Length of arrow along y-coordinate
Returns: a : FancyArrow
patches.FancyArrow object
Other Parameters: Optional kwargs (inherited from FancyArrow patch) control the arrow
construction and properties:
Constructor arguments
- width: float (default: 0.001)
-
width of full arrow tail
- length_includes_head: [True | False] (default: False)
-
True if head is to be counted in calculating the length.
- head_width: float or None (default: 3*width)
-
total width of the full arrow head
- head_length: float or None (default: 1.5 * head_width)
-
length of arrow head
- shape: [‘full’, ‘left’, ‘right’] (default: ‘full’)
-
draw the left-half, right-half, or full arrow
- overhang: float (default: 0)
-
fraction that the arrow is swept back (0 overhang means triangular shape). Can be negative or greater than one.
- head_starts_at_zero: [True | False] (default: False)
-
if True, the head starts being drawn at coordinate 0 instead of ending at coordinate 0.
Other valid kwargs (inherited from :class:`Patch`) are:
Property Description agg_filterunknown alphafloat or None animated[True | False] antialiasedor aa[True | False] or None for default capstyle[‘butt’ | ‘round’ | ‘projecting’] clip_boxa matplotlib.transforms.Bboxinstanceclip_on[True | False] clip_path[ ( Path,Transform) |Patch| None ]colormatplotlib color spec containsa callable function edgecoloror ecmpl color spec, None, ‘none’, or ‘auto’ facecoloror fcmpl color spec, or None for default, or ‘none’ for no color figurea matplotlib.figure.Figureinstancefill[True | False] gidan id string hatch[‘/’ | ‘' | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle[‘miter’ | ‘round’ | ‘bevel’] labelstring or anything printable with ‘%s’ conversion. linestyleor ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-'|'--'|'-.'|':'|'None'|' '|'']linewidthor lwfloat or None for default path_effectsunknown picker[None|float|boolean|callable] rasterized[True | False | None] sketch_paramsunknown snapunknown transformTransforminstanceurla url string visible[True | False] zorderany number Notes
The resulting arrow is affected by the axes aspect ratio and limits. This may produce an arrow whose head is not square with its stem. To create an arrow whose head is square with its stem, use
annotate()for example:ax.annotate("", xy=(0.5, 0.5), xytext=(0, 0), arrowprops=dict(arrowstyle="->"))
Examples using matplotlib.pyplot.arrow
© 2012–2017 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
http://matplotlib.org/2.1.0/api/_as_gen/matplotlib.pyplot.arrow.html