dolfinx.plotting

Functions

create_boundary_mesh(mesh, comm[, orient])

Create a mesh consisting of all exterior facets of a mesh Input: mesh - The mesh comm - The MPI communicator orient - Boolean flag for reorientation of facets to have consistent outwards-pointing normal (default: True) Output: bmesh - The boundary mesh bmesh_to_geometry - Map from cells of the boundary mesh to the geometry of the original mesh

create_cg1_function_space(mesh, sh)

mesh2triang(mesh)

mplot_dirichletbc(ax, obj, **kwargs)

mplot_expression(ax, f, mesh, **kwargs)

mplot_function(ax, f, **kwargs)

mplot_mesh(ax, mesh, **kwargs)

plot(object, *args, **kwargs)

Plot given object.

dolfinx.plotting.plot(object, *args, **kwargs)[source]

Plot given object.

Arguments
object

a Mesh, a Function, a Expression <dolfinx.Expression>, a DirichletBC <dolfinx.cpp.DirichletBC>, a FiniteElement.

Examples of usage

In the simplest case, to plot only e.g. a mesh, simply use

mesh = UnitSquare(4, 4)
plot(mesh)

Use the title argument to specify title of the plot

plot(mesh, tite="Finite element mesh")

It is also possible to plot an element

element = FiniteElement("BDM", tetrahedron, 3)
plot(element)

Vector valued functions can be visualized with an alternative mode

plot(u, mode = "glyphs")

A more advanced example

plot(u,
     wireframe = True,              # use wireframe rendering
     interactive = False,           # do not hold plot on screen
     scalarbar = False,             # hide the color mapping bar
     hardcopy_prefix = "myplot",    # default plotfile name
     scale = 2.0,                   # scale the warping/glyphs
     title = "Fancy plot",          # set your own title
     )