Actor.line_style

Actor.line_style#

property Actor.line_style: LineStyle | None[source]#

Return or set the dash style drawn along this actor’s lines.

Unlike pyvista.PolyDataFilters.dash_lines(), which splits the line cells into shorter cells, the dashes are produced by the fragment shader and keep a constant size on screen as the camera zooms. The geometry is unchanged and the dashes are not present in exported scenes.

Set to a style string to dash the lines, to '' to hide them, or to None to draw them solid. Accepts the same styles as pyvista.PolyDataFilters.dash_lines(). Use dash_interval to set the size of the interval pattern.

Added in version 0.50.

Notes#

Line styles#

Style

Description

Example

""

Hidden

../../../_images/ls_0.png

"-"

Solid

../../../_images/ls_1.png

"--"

Dashed

../../../_images/ls_2.png

":"

Dotted

../../../_images/ls_3.png

"-."

Dash-dot

../../../_images/ls_4.png

"-.."

Dash-dot-dot

../../../_images/ls_5.png
  • Requires an actor from add_mesh() with a line_style other than '-'.

  • Requires a mesh of line cells. Polygons and strips are rejected.

  • Edges drawn with show_edges=True are not dashed. Extract them with extract_all_edges() and add that as its own mesh.

  • Cells shorter on screen than line_width are drawn solid.

  • Cell scalars restart the pattern at each cell.

Examples#

Download Python source code | Download Jupyter notebook

Dash the lines of a circle.

>>> import pyvista as pv
>>> circle = pv.Circle(resolution=200).extract_all_edges()
>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(circle, color='black', line_width=4, line_style='--')
>>> pl.show(cpos='xy')
../../../_images/pyvista-Actor-line_style-bb8171df4c2cf04b_00_00.png