anastruct.fem.plotter.mpl ========================= .. py:module:: anastruct.fem.plotter.mpl Attributes ---------- .. autoapisummary:: anastruct.fem.plotter.mpl.PATCH_SIZE Classes ------- .. autoapisummary:: anastruct.fem.plotter.mpl.Plotter Module Contents --------------- .. py:data:: PATCH_SIZE :value: 0.03 .. py:class:: Plotter(system: anastruct.fem.system.SystemElements, mesh: int) .. py:attribute:: plot_values .. py:attribute:: mesh :type: int .. py:attribute:: system :type: anastruct.fem.system.SystemElements .. py:attribute:: axes :type: List[matplotlib.axes.Axes] :value: [] .. py:attribute:: one_fig :type: Optional[matplotlib.axes.Axes] :value: None .. py:attribute:: max_q :type: float :value: 0 .. py:attribute:: max_qn :type: float :value: 0 .. py:attribute:: max_system_point_load :type: float :value: 0 .. py:attribute:: fig :type: Optional[matplotlib.figure.Figure] :value: None .. py:attribute:: plot_colors :type: Dict[str, str] .. py:method:: change_plot_colors(colors: Dict) -> None Changes the plotting color for various components of the plot. Args: colors (Dict): A dictionary containing plot components and colors as key-value pairs. .. py:property:: max_val_structure :type: float Returns the maximum value of the structure. Returns: float: Maximum value of the structure .. py:method:: __start_plot(figsize: Optional[Tuple[float, float]]) -> Tuple[float, float] 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) .. py:method:: __fixed_support_patch(max_val: float, axes_i: int = 0) -> None 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. .. py:method:: __hinged_support_patch(max_val: float, axes_i: int = 0) -> None 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. .. py:method:: __rotational_support_patch(max_val: float, axes_i: int = 0) -> None 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. .. py:method:: __roll_support_patch(max_val: float, axes_i: int = 0) -> None 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. .. py:method:: __rotating_spring_support_patch(max_val: float, axes_i: int = 0) -> None 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. .. py:method:: __spring_support_patch(max_val: float, axes_i: int = 0) -> None 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. .. py:method:: __internal_hinges_patch(max_val: float, axes_i: int = 0) -> None 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. .. py:method:: __q_load_patch(max_val: float, verbosity: int, axes_i: int = 0) -> None 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. .. py:method:: __arrow_patch_values(Fx: float, Fy: float, node: anastruct.fem.node.Node, h: float) -> Tuple[float, float, float, float, float] :staticmethod: 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) .. py:method:: __point_load_patch(max_plot_range: float, verbosity: int = 0, axes_i: int = 0) -> None 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. .. py:method:: __moment_load_patch(max_val: float, axes_i: int = 0) -> None 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. .. py:method:: plot_structure(figsize: Optional[Tuple[float, float]], 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) -> Optional[matplotlib.figure.Figure] 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 .. py:method:: _add_node_values(x_val: numpy.ndarray, y_val: numpy.ndarray, value_1: float, value_2: float, digits: int, axes_i: int = 0) -> None 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. .. py:method:: _add_element_values(x_val: numpy.ndarray, y_val: numpy.ndarray, value: float, index: int, digits: int = 2, axes_i: int = 0) -> None 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. .. py:method:: plot_result(axis_values: Sequence, force_1: Optional[float] = None, force_2: Optional[float] = None, digits: int = 2, node_results: bool = True, fill_polygon: bool = True, color: str = 'b', axes_i: int = 0) -> None 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. .. py:method:: plot() -> None Plots the figure. .. py:method:: axial_force(factor: Optional[float] = None, figsize: Optional[Tuple[float, float]] = None, verbosity: int = 0, scale: float = 1, offset: Sequence[float] = (0, 0), show: bool = True, gridplot: bool = False, axes_i: int = 0) -> Optional[matplotlib.figure.Figure] 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 .. py:method:: bending_moment(factor: Optional[float] = None, figsize: Optional[Tuple[float, float]] = None, verbosity: int = 0, scale: float = 1, offset: Sequence[float] = (0, 0), show: bool = True, gridplot: bool = False, axes_i: int = 0) -> Optional[matplotlib.figure.Figure] 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 .. py:method:: shear_force(factor: Optional[float] = None, figsize: Optional[Tuple[float, float]] = 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) -> Optional[matplotlib.figure.Figure] 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 .. py:method:: reaction_force(figsize: Optional[Tuple[float, float]], verbosity: int, scale: float, offset: Sequence[float], show: bool, gridplot: bool = False, axes_i: int = 0) -> Optional[matplotlib.figure.Figure] 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 .. py:method:: displacements(factor: Optional[float] = None, figsize: Optional[Tuple[float, float]] = 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) -> Optional[matplotlib.figure.Figure] 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 .. py:method:: results_plot(figsize: Optional[Tuple[float, float]], verbosity: int, scale: float, offset: Sequence[float], show: bool) -> Optional[matplotlib.figure.Figure] 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