9.1. Modal Shapes
- plotter.plot_modes(node_list, mode_shape_vectors, T, export_path=None)[source]
Plots 2-D mode shape profiles in a square grid layout (2×2, 3×3, …).
Each mode occupies one cell with two side-by-side profile plots: left = X-displacement vs Z (blue), right = Y-displacement vs Z (green). Normalised displacement values are annotated next to every node dot. A grey undeformed reference line (x=0) is drawn in every panel.
9.1. Sign convention
Eigenvectors have arbitrary sign. The method flips each mode so that the top-node displacement in the dominant horizontal direction is always positive.
9.1. Grid layout
ncols = ceil(sqrt(N)),nrows = ceil(N / ncols). Unused cells in the last row are hidden.9.1. Title placement
Each mode title (e.g.
'Mode 1 [X-dir] — T₁ = 0.312 s') is placed viafig.text()at the horizontal midpoint of both panels so that it is centred over the X- and Y-displacement plots together.9.1. Adaptive scaling
Font sizes for node annotations, axis labels, tick marks, and panel titles, as well as the vertical panel spacing (
hspace) and the figure top margin (top), all scale automatically with the number of grid rows and the number of nodes per panel. This prevents text and title overlap when plotting a large number of modes.- param node_list:
Ordered OpenSees node tags (base node first).
- type node_list:
list of int
- param mode_shape_vectors:
One array per mode; columns are [ux, uy, uz], pre-normalised by max abs value as returned by
do_modal_analysis.- type mode_shape_vectors:
list of numpy.ndarray, shape (n_nodes, 3)
- param T:
Natural periods [s] for each mode.
- type T:
list of float
- param export_path:
File path to save the figure. If
Nonethe figure is displayed interactively.- type export_path:
str, optional
- rtype:
None
Example
from openquake.vmtk.plotter import plotter
pl = plotter()
# T, mode_shapes from modeller.do_modal_analysis()
pl.plot_modes(
node_list=model.node_list,
mode_shape_vectors=mode_shapes,
T=T,
export_path="mode_shapes.png",
)