vispy.visuals.line.line module#
Line visual implementing Agg- and GL-based drawing modes.
- class vispy.visuals.line.line.LineVisual(pos=None, color=(0.5, 0.5, 0.5, 1), width=1, connect='strip', method='gl', antialias=False)#
Bases:
CompoundVisual
Line 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.
- 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.
- property antialias#
- property cap_types#
- property color#
- property connect#
- property join_types#
- property method#
The current drawing method
- property pos#
- set_data(pos=None, color=None, width=None, connect=None)#
Set the data used to draw 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.
- width:
The width of the line in px. Line widths < 1 px will be rounded up to 1 px when using the ‘gl’ 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
int numpy arrays specify the exact set of segment pairs to connect.
bool numpy arrays specify which _adjacent_ pairs to connect.
- property width#