import dolfinx.mesh
import mpi4py.MPI
import viskex
Generate a mesh of the unit square by dividing each edge of the square in 6 segments.
square = dolfinx.mesh.create_unit_square(mpi4py.MPI.COMM_WORLD, 6, 6)
Each plotting function accepts optional keyword arguments, that are passed directly to the add_mesh method of the underlying pyvista plotter. For instance, the following two notebook cells plot the mesh using pyvista default color (red) first, and then using a custom color provided as a keyword argument (blue).
viskex.dolfinx.plot_mesh(square)
2026-03-23 05:07:56.404 ( 0.992s) [ 7F9542166140]vtkXOpenGLRenderWindow.:1460 WARN| bad X server connection. DISPLAY=
viskex.dolfinx.plot_mesh(square, color="blue")