bluemira.structural.plotting

Structural module plotting tools

Attributes

DEFAULT_STRUCT_PLOT_OPTIONS

Classes

BasePlotter

Base utility plotting class for structural models

GeometryPlotter

Utility class for the plotting of structural geometry models

DeformedGeometryPlotter

Utility class for the plotting of structural deformed geometry models and

StressDeformedGeometryPlotter

Utility class for the plotting of structural deformed geometry models and

Functions

annotate_node(ax, node, text_size, color)

Annotate a node.

annotate_element(ax, element, text_size, color)

Annotate an element.

arrow_scale(→ numpy.ndarray)

Scales an arrow such that, regardless of direction, it has a reasonable

_plot_force(ax, node, vector[, color])

Plots a single force arrow in 3-D to indicate a linear load

_plot_moment(ax, node, vector[, color, support])

Plots a double "moment" arrow in 3-D to indicate a moment load. Offset the

Module Contents

bluemira.structural.plotting.DEFAULT_STRUCT_PLOT_OPTIONS
bluemira.structural.plotting.annotate_node(ax: matplotlib.pyplot.Axes, node: bluemira.structural.node.Node, text_size: int, color: str)

Annotate a node.

Parameters:
bluemira.structural.plotting.annotate_element(ax: matplotlib.pyplot.Axes, element: bluemira.structural.element.Element, text_size: int, color: str)

Annotate an element.

Parameters:
bluemira.structural.plotting.arrow_scale(vector: numpy.ndarray, max_length: float, max_force: float) numpy.ndarray

Scales an arrow such that, regardless of direction, it has a reasonable size

Parameters:
  • vector (numpy.ndarray) – 3-D vector of the arrow (3)

  • max_length (float) – The maximum length of the arrow

  • max_force (float) – The maximum force value in the model (absolute)

Return type:

The scaled force arrow (3)

bluemira.structural.plotting._plot_force(ax: matplotlib.pyplot.Axes, node: bluemira.structural.node.Node, vector: numpy.ndarray, color: str = 'r')

Plots a single force arrow in 3-D to indicate a linear load

Parameters:
  • ax (matplotlib.pyplot.Axes) – The ax on which to plot

  • node (bluemira.structural.node.Node) – The node or location at which the force occurs

  • vector (numpy.ndarray) – The force direction vector

  • color (str) – The color to plot the force as

bluemira.structural.plotting._plot_moment(ax: matplotlib.pyplot.Axes, node: bluemira.structural.node.Node, vector: numpy.ndarray, color: str = 'r', *, support: bool = False)

Plots a double “moment” arrow in 3-D to indicate a moment load. Offset the moment arrows off from the nodes a little, to enable overlaps with forces.

Parameters:
  • ax (matplotlib.pyplot.Axes) – The ax on which to plot

  • node (bluemira.structural.node.Node) – The node or location at which the force occurs

  • vector (numpy.ndarray) – The force direction vector

  • color (str) – The color to plot the force as

  • support (bool)

class bluemira.structural.plotting.BasePlotter(geometry: bluemira.structural.geometry.Geometry, ax: matplotlib.pyplot.Axes | None = None, **kwargs)

Base utility plotting class for structural models

Parameters:
geometry
options
_unit_length = None
_force_size = None
_size = None
color_normer = None
property unit_length: float

the minimum element size

Type:

Calculates a characteristic unit length for the model

Return type:

float

property force_size: float

Calculates a characteristic force vector length for plotting purposes

Return type:

The minimum and maximum forces

property size: float

Calculates the size of the model bounding box

Return type:

float

property text_size: int

Get a reasonable guess of the font size to use in plotting.

Returns:

size – The font size to use in plotting

Return type:

float

plot_nodes()

Plots all the Nodes in the Geometry.

plot_supports()

Plots all supports in the Geometry.

plot_elements()

Plots all of the Elements in the Geometry.

plot_cross_sections()

Plots the cross-sections for each Element in the Geometry, rotated to the mid-point of the Element.

plot_loads()

Plots all of the loads applied to the geometry

_plot_node_load(node, load)
_plot_element_load(element, load)
_plot_distributed_load(element, load)
_set_aspect_equal()

Hack to make matplotlib 3D look good. Draw a white bounding box around the nodes

class bluemira.structural.plotting.GeometryPlotter(geometry: bluemira.structural.geometry.Geometry, ax: matplotlib.pyplot.Axes | None = None, **kwargs)

Bases: BasePlotter

Inheritance diagram of bluemira.structural.plotting.GeometryPlotter

Utility class for the plotting of structural geometry models

Parameters:
options
class bluemira.structural.plotting.DeformedGeometryPlotter(geometry: bluemira.structural.geometry.DeformedGeometry, ax: matplotlib.pyplot.Axes | None = None, **kwargs)

Bases: BasePlotter

Inheritance diagram of bluemira.structural.plotting.DeformedGeometryPlotter

Utility class for the plotting of structural deformed geometry models and overlaying with GeometryPlotters

Parameters:
options
class bluemira.structural.plotting.StressDeformedGeometryPlotter(geometry: bluemira.structural.geometry.DeformedGeometry, ax: matplotlib.pyplot.Axes | None = None, stress: numpy.ndarray | None = None, *, deflection: bool = False, **kwargs)

Bases: BasePlotter

Inheritance diagram of bluemira.structural.plotting.StressDeformedGeometryPlotter

Utility class for the plotting of structural deformed geometry models and overlaying with GeometryPlotters

Parameters:
options
color_normer
static make_color_normer(stress: numpy.ndarray, *, deflection: bool = False)

Make a ColorNorm object for the plot based on the stress values.

Parameters:
  • stress (numpy.ndarray)

  • deflection (bool)