femlabpy.plotting#

Lightweight Matplotlib plotting helpers for quick FEM inspection.

Workflow role#

These functions are not a full visualization subsystem. They are compact, teaching-oriented helpers for checking meshes, supports, nodal loads, deformed shapes, and contour-like stress fields directly from the FemLab-style tables used throughout the package.

Public entry points#

  • plotelem draws the undeformed mesh and optional labels.

  • plotforces and plotbc overlay external loads and constraints.

  • plotq4 and plott3 reconstruct scalar fields for quadrilateral and triangular meshes.

  • plotu draws scalar nodal fields or displacement-derived contours.

Functions#

plotbc(T, X, C[, ax])

Plot prescribed boundary conditions on a 2D mesh view.

plotelem(T, X[, line_style, nonum, noelem, ax])

Plot the undeformed mesh and optionally annotate node or element numbers.

plotforces(T, X, P[, ax])

Plot nodal loads as arrows on a 2D mesh view.

plotq4(T, X, S, scomp[, ax])

Plot a contour field reconstructed from Q4 Gauss-point results.

plott3(T, X, S, scomp[, ax])

Plot a contour field from T3 element results.

plotu(T, X, u[, dof, component, ax])

Plot a scalar nodal field or displacement-derived contour.

Function Reference#

femlabpy.plotting.plotbc(T, X, C, ax=None)[source]#

Plot prescribed boundary conditions on a 2D mesh view.

femlabpy.plotting.plotelem(T, X, line_style: str = 'k-', nonum: bool = False, noelem: bool = False, ax=None)[source]#

Plot the undeformed mesh and optionally annotate node or element numbers.

femlabpy.plotting.plotforces(T, X, P, ax=None)[source]#

Plot nodal loads as arrows on a 2D mesh view.

femlabpy.plotting.plotq4(T, X, S, scomp: int, ax=None)[source]#

Plot a contour field reconstructed from Q4 Gauss-point results.

femlabpy.plotting.plott3(T, X, S, scomp: int, ax=None)[source]#

Plot a contour field from T3 element results.

femlabpy.plotting.plotu(T, X, u, dof: int | None = None, component: int = 0, ax=None)[source]#

Plot a scalar nodal field or displacement-derived contour.

Parameters:
Tarray_like

Element topology table with one-based node ids and a trailing property id.

Xarray_like

Nodal coordinates. Flat Gmsh (x, y, z) meshes are plotted in 2D.

uarray_like

Either one scalar value per node, a (nn, ncomp) nodal field, or a flattened global vector with length nn * dof.

dofint, optional

Degrees of freedom per node when u is passed as a flattened global vector. When omitted, u is treated as a scalar nodal field unless it is already shaped as (nn, ncomp).

componentint, default 0

Which nodal component to plot when u contains multiple values per node. Use 0 for magnitude, 1 for the first component, 2 for the second component, and so on.

axmatplotlib.axes.Axes, optional

Existing Matplotlib axes. A new axes object is created when omitted.