import dolfinx.mesh
import mpi4py.MPI
import pyvista
import viskex
Generate a mesh of the unit cube by dividing each edge of the cube in 6 segments.
cube = dolfinx.mesh.create_unit_cube(mpi4py.MPI.COMM_WORLD, 6, 6, 6)
Create plotters for each topological dimension using the lower level viskex.DolfinxPlotter
class instead of the viskex.dolfinx
functions. Pass a common pyvista.Plotter
to the viskex
plot function. Do not show each plotter yet.
plotter = pyvista.Plotter(shape=(2, 2))
for row in range(2):
for col in range(2):
plotter.subplot(row, col)
viskex.DolfinxPlotter.plot_mesh(cube, dim=3 - row * 2 - col, plotter=plotter)
Finally, link cameras together and show the plot with subplots.
plotter.link_views()
plotter.show()