Visualization
The package exports a single viz
command that can be used to add objects to the scene with a consistent set of options.
Meshes.viz
— Functionviz(object; [options])
Visualize Meshes.jl object
with various options
.
Available options
color
- color of geometriesalpha
- transparency in [0,1]colormap
- color scheme/map from ColorSchemes.jlcolorrange
- minimum and maximum color valuesshowsegments
- visualize segmentssegmentcolor
- color of segmentssegmentsize
- width of segmentsshowpoints
- visualize pointspointmarker
- marker of pointspointcolor
- color of pointspointsize
- size of points
The option color
can be a single scalar or a vector of scalars. For Mesh
subtypes, the length of the vector of colors determines if the colors should be assigned to vertices or to elements.
Examples
Different coloring methods (vertex vs. element):
# vertex coloring (i.e. linear interpolation)
viz(mesh, color = 1:nvertices(mesh))
# element coloring (i.e. discrete colors)
viz(mesh, color = 1:nelements(mesh))
Different strategies to show the boundary of geometries (showsegments vs. boundary):
# visualize boundary with showsegments
viz(polygon, showsegments = true)
# visualize boundary with separate call
viz(polygon)
viz!(boundary(polygon))
Notes
- This function will only work in the presence of a Makie.jl backend via package extensions in Julia v1.9 or later versions of the language.
Meshes.viz!
— Functionviz!(object; [options])
Visualize Meshes.jl object
in an existing scene with options
forwarded to viz
.
Geometries
We can visualize a single geometry or multiple geometries in a vector:
triangles = rand(Triangle, 10, crs=Cartesian2D)
viz(triangles, color = 1:10)
Domains
Alternatively, we can visualize domains with topological information such as Mesh
and show facets efficiently:
grid = CartesianGrid(10, 10, 10)
viz(grid, showsegments = true, segmentcolor = :teal)