vispy.visuals.line.arrow module#
Arrows are a subclass of line visuals, which adds the ability to put several heads on a line.
- class vispy.visuals.line.arrow.ArrowVisual(pos=None, color=(0.5, 0.5, 0.5, 1), width=1, connect='strip', method='gl', antialias=False, arrows=None, arrow_type='stealth', arrow_size=None, arrow_color=(0.5, 0.5, 0.5, 1))#
Bases:
LineVisual
Arrow visual
A special line visual which can also draw optional arrow heads at the specified vertices.
You add an arrow head by specifying two vertices v1 and v2 which represent the arrow body. This visual will draw an arrow head using v2 as center point, and the orientation of the arrow head is automatically determined by calculating the direction vector between v1 and v2. The arrow head can be detached from arrow body.
- Parameters:
- posarray
Array of shape (…, 2) or (…, 3) specifying vertex coordinates of arrow body.
- colorColor, tuple, or array
The color to use when drawing the line. If an array is given, it must be of shape (…, 4) and provide one rgba color per vertex. Can also be a colormap name, or appropriate Function.
- width:
The width of the line in px. Line widths > 1px are only guaranteed to work when using ‘agg’ method.
- connectstr or array
Determines which vertices are connected by lines.
“strip” causes the line to be drawn with each vertex connected to the next.
“segments” causes each pair of vertices to draw an independent line segment
numpy arrays specify the exact set of segment pairs to connect.
- methodstr
Mode to use for drawing.
“agg” uses anti-grain geometry to draw nicely antialiased lines with proper joins and endcaps.
“gl” uses OpenGL’s built-in line rendering. This is much faster, but produces much lower-quality results and is not guaranteed to obey the requested line width or join/endcap styles.
- antialiasbool
Enables or disables antialiasing. For method=’gl’, this specifies whether to use GL’s line smoothing, which may be unavailable or inconsistent on some platforms.
- arrowsarray
A (N, 4) or (N, 6) matrix where each row contains the (x, y) or the (x, y, z) coordinates of the first and second vertex of the arrow head. Remember that the second vertex is used as center point for the arrow head, and the first vertex is only used for determining the arrow head orientation.
- arrow_typestring
Specify the arrow head type, the currently available arrow head types are:
stealth
curved
triangle_30
triangle_60
triangle_90
angle_30
angle_60
angle_90
inhibitor_round
- arrow_sizefloat
Specify the arrow size
- arrow_colorColor, tuple, or array
The arrow head color. If an array is given, it must be of shape (…, 4) and provide one rgba color per arrow head. Can also be a colormap name, or appropriate Function.
- property arrow_color#
- property arrow_size#
- property arrow_type#
- property arrows#
- set_data(pos=None, color=None, width=None, connect=None, arrows=None)#
Set the data used for this visual
- Parameters:
- posarray
Array of shape (…, 2) or (…, 3) specifying vertex coordinates.
- colorColor, tuple, or array
The color to use when drawing the line. If an array is given, it must be of shape (…, 4) and provide one rgba color per vertex. Can also be a colormap name, or appropriate Function.
- width:
The width of the line in px. Line widths > 1px are only guaranteed to work when using ‘agg’ method.
- connectstr or array
Determines which vertices are connected by lines.
“strip” causes the line to be drawn with each vertex connected to the next.
“segments” causes each pair of vertices to draw an independent line segment
numpy arrays specify the exact set of segment pairs to connect.
- arrowsarray
A (N, 4) or (N, 6) matrix where each row contains the (x, y) or the (x, y, z) coordinate of the first and second vertex of the arrow body. Remember that the second vertex is used as center point for the arrow head, and the first vertex is only used for determining the arrow head orientation.