anastruct.fem.plotter.mpl
Attributes
Classes
Module Contents
- class anastruct.fem.plotter.mpl.Plotter(system: anastruct.fem.system.SystemElements, mesh: int)[source]
-
- change_plot_colors(colors: Dict) None[source]
Changes the plotting color for various components of the plot.
- Args:
colors (Dict): A dictionary containing plot components and colors as key-value pairs.
- property max_val_structure: float[source]
Returns the maximum value of the structure.
- Returns:
float: Maximum value of the structure
- __start_plot(figsize: Tuple[float, float] | None) Tuple[float, float][source]
Starts the plot by initialising a matplotlib plot window of the given size.
- Args:
figsize (Optional[Tuple[float, float]]): Figure size
- Returns:
Tuple[float, float]: Figure size (width, height)
- __fixed_support_patch(max_val: float, axes_i: int = 0) None[source]
Plots the fixed supports.
- Args:
max_val (float): Max scale of the plot axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- __hinged_support_patch(max_val: float, axes_i: int = 0) None[source]
Plots the hinged supports.
- Args:
max_val (float): Max scale of the plot axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- __rotational_support_patch(max_val: float, axes_i: int = 0) None[source]
Plots the rotational supports.
- Args:
max_val (float): Max scale of the plot axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- __roll_support_patch(max_val: float, axes_i: int = 0) None[source]
Plots the roller supports.
- Args:
max_val (float): Max scale of the plot axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- __rotating_spring_support_patch(max_val: float, axes_i: int = 0) None[source]
Plots the rotational spring supports.
- Args:
max_val (float): Max scale of the plot axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- __spring_support_patch(max_val: float, axes_i: int = 0) None[source]
Plots the linear spring supports.
- Args:
max_val (float): Max scale of the plot axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- __internal_hinges_patch(max_val: float, axes_i: int = 0) None[source]
Plots the internal hinges.
- Args:
max_val (float): Max scale of the plot axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- __q_load_patch(max_val: float, verbosity: int, axes_i: int = 0) None[source]
Plots the distributed loads.
xn1;yn1 q-load xn1;yn1
|__________________| x1;y1 element x2;y2
- Args:
max_val (float): Max scale of the plot verbosity (int): 0: show values and arrows, 1: show load block only axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- static __arrow_patch_values(Fx: float, Fy: float, node: anastruct.fem.node.Node, h: float) Tuple[float, float, float, float, float][source]
Determines the values for the point load arrow patch.
- Args:
Fx (float): Point load magnitude in x direction Fy (float): Point load magnitude in y direction node (Node): Node upon which load is applied h (float): Scale variable
- Returns:
Tuple[float, float, float, float, float]: x, y, len_x, len_y, F (for matplotlib plotter)
- __point_load_patch(max_plot_range: float, verbosity: int = 0, axes_i: int = 0) None[source]
Plots the point loads.
- Args:
max_plot_range (float): Max scale of the plot verbosity (int, optional): 0: show values, 1: show arrow only. Defaults to 0. axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- __moment_load_patch(max_val: float, axes_i: int = 0) None[source]
Plots the moment loads.
- Args:
max_val (float): Max scale of the plot axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- plot_structure(figsize: Tuple[float, float] | None, verbosity: int, show: bool = False, supports: bool = True, scale: float = 1, offset: Sequence[float] = (0, 0), gridplot: bool = False, annotations: bool = True, axes_i: int = 0) matplotlib.figure.Figure | None[source]
Plots the structure.
- Args:
figsize (Optional[Tuple[float, float]]): Figure size verbosity (int): 0: show node and element IDs, 1: show structure only show (bool, optional): If True, plt.figure will plot. Defaults to False. supports (bool, optional): If True, supports are plotted. Defaults to True. scale (float, optional): Scale of the plot. Defaults to 1. offset (Sequence[float], optional): Offset of the plot. Defaults to (0, 0). gridplot (bool, optional): If True, the plot will be added to a grid of plots. Defaults to False. annotations (bool, optional): If True, structure annotations are plotted. Defaults to True. axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- Returns:
Optional[Figure]: Returns figure object if in testing mode, else None
- _add_node_values(x_val: numpy.ndarray, y_val: numpy.ndarray, value_1: float, value_2: float, digits: int, axes_i: int = 0) None[source]
Adds the node values to the plot.
- Args:
x_val (np.ndarray): X locations y_val (np.ndarray): Y locations value_1 (float): Value of first number value_2 (float): Value of second number digits (int): Number of digits to round to axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- _add_element_values(x_val: numpy.ndarray, y_val: numpy.ndarray, value: float, index: int, digits: int = 2, axes_i: int = 0) None[source]
Adds the element values to the plot.
- Args:
x_val (np.ndarray): X locations y_val (np.ndarray): Y locations value (float): Value of number index (int): Index of value digits (int, optional): Number of digits to round to. Defaults to 2. axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- plot_result(axis_values: Sequence, force_1: float | None = None, force_2: float | None = None, digits: int = 2, node_results: bool = True, fill_polygon: bool = True, color: str = 'b', axes_i: int = 0) None[source]
Plots a single result on the structure.
- Args:
axis_values (Sequence): X and Y values force_1 (Optional[float], optional): First force to plot. Defaults to None. force_2 (Optional[float], optional): Second force to plot. Defaults to None. digits (int, optional): Number of digits to round to. Defaults to 2. node_results (bool, optional): Whether or not to plot nodal results. Defaults to True. fill_polygon (bool, optional): Whether or not to fill a polygon for the result. Defaults to True. color (int, optional): Color index with which to draw. Defaults to 0. axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- axial_force(factor: float | None = None, figsize: Tuple[float, float] | None = None, verbosity: int = 0, scale: float = 1, offset: Sequence[float] = (0, 0), show: bool = True, gridplot: bool = False, axes_i: int = 0) matplotlib.figure.Figure | None[source]
Plots the axial force.
- Args:
factor (Optional[float], optional): Scaling factor. Defaults to None. figsize (Optional[Tuple[float, float]], optional): Figure size. Defaults to None. verbosity (int, optional): 0: show values, 1: show axial force only. Defaults to 0. scale (float, optional): Scale of the plot. Defaults to 1. offset (Sequence[float], optional): Offset of the plot. Defaults to (0, 0). show (bool, optional): If True, plt.figure will plot. Defaults to False. gridplot (bool, optional): If True, the plot will be added to a grid of plots. Defaults to False. axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- Returns:
Optional[Figure]: Returns figure object if in testing mode, else None
- bending_moment(factor: float | None = None, figsize: Tuple[float, float] | None = None, verbosity: int = 0, scale: float = 1, offset: Sequence[float] = (0, 0), show: bool = True, gridplot: bool = False, axes_i: int = 0) matplotlib.figure.Figure | None[source]
Plots the bending moment.
- Args:
factor (Optional[float], optional): Scaling factor. Defaults to None. figsize (Optional[Tuple[float, float]], optional): Figure size. Defaults to None. verbosity (int, optional): 0: show values, 1: show bending moment only. Defaults to 0. scale (float, optional): Scale of the plot. Defaults to 1. offset (Sequence[float], optional): Offset of the plot. Defaults to (0, 0). show (bool, optional): If True, plt.figure will plot. Defaults to False. gridplot (bool, optional): If True, the plot will be added to a grid of plots. Defaults to False. axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- Returns:
Optional[Figure]: Returns figure object if in testing mode, else None
- shear_force(factor: float | None = None, figsize: Tuple[float, float] | None = None, verbosity: int = 0, scale: float = 1, offset: Sequence[float] = (0, 0), show: bool = True, gridplot: bool = False, include_structure: bool = True, axes_i: int = 0) matplotlib.figure.Figure | None[source]
Plots the shear force.
- Args:
factor (Optional[float], optional): Scaling factor. Defaults to None. figsize (Optional[Tuple[float, float]], optional): Figure size. Defaults to None. verbosity (int, optional): 0: show values, 1: show shear force only. Defaults to 0. scale (float, optional): Scale of the plot. Defaults to 1. offset (Sequence[float], optional): Offset of the plot. Defaults to (0, 0). show (bool, optional): If True, plt.figure will plot. Defaults to False. gridplot (bool, optional): If True, the plot will be added to a grid of plots. Defaults to False. include_structure (bool, optional): If True, the structure will be plotted. Defaults to True. axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- Returns:
Optional[Figure]: Returns figure object if in testing mode, else None
- reaction_force(figsize: Tuple[float, float] | None, verbosity: int, scale: float, offset: Sequence[float], show: bool, gridplot: bool = False, axes_i: int = 0) matplotlib.figure.Figure | None[source]
Plots the reaction forces.
- Args:
figsize (Optional[Tuple[float, float]]): Figure size verbosity (int): 0: show node and element IDs, 1: show structure only scale (float): Scale of the plot offset (Sequence[float]): Offset of the plot show (bool): If True, plt.figure will plot gridplot (bool, optional): If True, the plot will be added to a grid of plots. Defaults to False. axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- Returns:
Optional[Figure]: Returns figure object if in testing mode, else None
- displacements(factor: float | None = None, figsize: Tuple[float, float] | None = None, verbosity: int = 0, scale: float = 1, offset: Sequence[float] = (0, 0), show: bool = True, linear: bool = False, gridplot: bool = False, axes_i: int = 0) matplotlib.figure.Figure | None[source]
Plots the displacements.
- Args:
factor (Optional[float], optional): Scaling factor. Defaults to None. figsize (Optional[Tuple[float, float]], optional): Figure size. Defaults to None. verbosity (int, optional): 0: show values, 1: show displacements only. Defaults to 0. scale (float, optional): Scale of the plot. Defaults to 1. offset (Sequence[float], optional): Offset of the plot. Defaults to (0, 0). show (bool, optional): If True, plt.figure will plot. Defaults to False. linear (bool, optional): If True, the bending in between the elements is determined. Defaults to False. gridplot (bool, optional): If True, the plot will be added to a grid of plots. Defaults to False. axes_i (int, optional): Which set of axes to plot on (for multi-plot windows). Defaults to 0.
- Returns:
Optional[Figure]: Returns figure object if in testing mode, else None
- results_plot(figsize: Tuple[float, float] | None, verbosity: int, scale: float, offset: Sequence[float], show: bool) matplotlib.figure.Figure | None[source]
Plots all the results in one gridded figure.
- Args:
figsize (Optional[Tuple[float, float]]): Figure size verbosity (int): 0: show values, 1: show arrows and polygons only scale (float): Scale of the plot offset (Sequence[float]): Offset of the plot show (bool): If True, plt.figure will plot
- Returns:
Optional[Figure]: Returns figure object if in testing mode, else None