PolyDataFilters.dash_lines#
- PolyDataFilters.dash_lines(
- style: LineStyle | None = None,
- *,
- pattern: VectorLikeFloat | None = None,
- scale: float | None = None,
- join: bool = True,
- inplace: bool = False,
- progress_bar: bool = False,
Split line cells into dashes.
Line and polyline cells are resampled into shorter line cells following a repeating on-off pattern. Only those cells are returned, so vertices, polygons and strips are removed.
Point data is interpolated onto the dash end points. Cell data is copied from the parent line cell, unless
joinmerges those cells together.Added in version 0.50.
- Parameters:
- style
str, optional Named dash pattern, one of:
'': hidden, returning no lines at all.'-': solid, returning the lines whole.'--': dashed, equivalent topattern=[8, 8].':': dotted, equivalent topattern=[1, 7, 1, 7].'-.': dash-dot, equivalent topattern=[4, 6, 2, 4].'-..': dash-dot-dot, equivalent topattern=[3, 3, 1, 3, 3, 3].
Every named style repeats over sixteen intervals. Defaults to
'--'. Cannot be set together withpattern.- pattern
VectorLikeFloat, optional Lengths of alternating drawn and undrawn intervals, starting with a drawn one and repeating.
[4, 6, 2, 4]draws four intervals, skips six, draws two and skips four. Cannot be set together withstyle.- scale
float, optional Length of one pattern interval in world units. Defaults to
lengthdivided by200.- joinbool, default:
True Join connected line cells into polylines with
strip()first so the pattern runs continuously across them. Joined cells have no cell data of their own, so the input’s cell data is dropped.- inplacebool, default:
False Update this dataset in place. When
False, return a new dataset.- progress_barbool, default:
False Display a progress bar to indicate progress.
- style
- Returns:
pyvista.PolyDataDataset holding the dashes as its only cells.
Notes#
Style |
Description |
Example |
|---|---|---|
|
Hidden |
|
|
Solid |
|
|
Dashed |
|
|
Dotted |
|
|
Dash-dot |
|
|
Dash-dot-dot |
|
Examples#
Download Python source code | Download Jupyter notebook
Dash a circle.
>>> import pyvista as pv
>>> circle = pv.Circle(resolution=200).extract_all_edges()
>>> circle.dash_lines().plot(color='black', line_width=4, cpos='xy')
Use a long dash and a short one instead of a named style.
>>> dashed = circle.dash_lines(pattern=[6, 2, 2, 2])
>>> dashed.plot(color='black', line_width=4, cpos='xy')
See Also#
pyvista.PolyDataFilters.stripJoin connected line cells into polylines.
pyvista.PolyDataFilters.tubeGenerate a tube around each input line.
pyvista.Actor.line_styleDash an actor’s lines in the shader instead of splitting the cells.
Used In#
Gallery Examples