Skip to content

rectangular

structural_sections.concrete.reinforced_concrete_sections.plotters.rectangular

Plotter for Reinforced Rectangular Cross-Sections.

Classes:

structural_sections.concrete.reinforced_concrete_sections.plotters.rectangular.RectangularCrossSectionPlotter

RectangularCrossSectionPlotter(cross_section: T)

Plotter for Reinforced Rectangular Cross-Sections (RRCS).

Initialize the RRCSPlotter.

Parameters:

  • cross_section (T) –

    Reinforced cross-section to plot.

Source code in blueprints/structural_sections/concrete/reinforced_concrete_sections/plotters/rectangular.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def __init__(
    self,
    cross_section: T,
) -> None:
    """Initialize the RRCSPlotter.

    Parameters
    ----------
    cross_section: RectangularReinforcedCrossSection
        Reinforced cross-section to plot.
    """
    self.cross_section = cross_section
    self.fig: plt.Figure | None = None
    self.axes: list[Axes] = []

structural_sections.concrete.reinforced_concrete_sections.plotters.rectangular.RectangularCrossSectionPlotter.legend_text

legend_text() -> str

Creates the legend text.

Returns:

  • str

    Legend text.

Source code in blueprints/structural_sections/concrete/reinforced_concrete_sections/plotters/rectangular.py
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
def legend_text(self) -> str:
    """Creates the legend text.

    Returns
    -------
    str
        Legend text.
    """
    # start building legend
    steel_materials = self.cross_section.get_present_steel_materials()
    if steel_materials:
        main_steel_material_used = steel_materials[0].name
        legend_text = f"{self.cross_section.concrete_material.concrete_class.value} - {main_steel_material_used}"
    else:
        legend_text = f"{self.cross_section.concrete_material.concrete_class.value}"

    legend_text += self._add_stirrups_to_legend()
    legend_text += self._add_longitudinal_rebars_to_legend()
    legend_text += self._add_rebar_configurations_to_legend()
    legend_text += self._add_single_longitudinal_rebars_to_legend()
    legend_text += self._add_covers_info_to_legend()

    return legend_text

structural_sections.concrete.reinforced_concrete_sections.plotters.rectangular.RectangularCrossSectionPlotter.plot

plot(
    figsize: tuple[float, float] = (15.0, 8.0),
    title: str | None = None,
    font_size_title: float = 18.0,
    font_size_legend: float = 10.0,
    include_legend: bool = True,
    font_size_dimension: float = 12.0,
    custom_text_legend: str | None = None,
    custom_text_width: str | None = None,
    custom_text_height: str | None = None,
    offset_line_width: float = 1.25,
    offset_line_height: float = 1.2,
    center_line_style: dict[str, float | str] | None = None,
    show: bool = False,
    axes_i: int = 0,
) -> Figure

Plots the cross-section.

Parameters:

  • figsize (tuple[float, float], default: (15.0, 8.0) ) –

    Size of the plot window.

  • title (str | None, default: None ) –

    Title of the plot.

  • font_size_title (float, default: 18.0 ) –

    Font size of the title.

  • font_size_legend (float, default: 10.0 ) –

    Font size of the legend.

  • include_legend (bool, default: True ) –

    Include legend in the plot.

  • font_size_dimension (float, default: 12.0 ) –

    Font size of the dimensions.

  • custom_text_legend (str | None, default: None ) –

    Custom text for the legend.

  • custom_text_width (str | None, default: None ) –

    Custom text for the width dimension. Replaces the width of the cross-section with the custom text.

  • custom_text_height (str | None, default: None ) –

    Custom text for the height dimension. Replaces the height of the cross-section with the custom text.

  • offset_line_width (float, default: 1.25 ) –

    Offset of the width line.

  • offset_line_height (float, default: 1.2 ) –

    Offset of the height line.

  • center_line_style (dict[str, float | str] | None, default: None ) –

    Style of the center lines. Check matplotlib documentation for more information (Annotation-arrowprops).

  • show (bool, default: False ) –

    Show the plot.

  • axes_i (int, default: 0 ) –

    Index of the axes to plot on. Default is 0.

Returns:

  • Figure

    Matplotlib figure.

Source code in blueprints/structural_sections/concrete/reinforced_concrete_sections/plotters/rectangular.py
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
def plot(
    self,
    figsize: tuple[float, float] = (15.0, 8.0),
    title: str | None = None,
    font_size_title: float = 18.0,
    font_size_legend: float = 10.0,
    include_legend: bool = True,
    font_size_dimension: float = 12.0,
    custom_text_legend: str | None = None,
    custom_text_width: str | None = None,
    custom_text_height: str | None = None,
    offset_line_width: float = 1.25,
    offset_line_height: float = 1.2,
    center_line_style: dict[str, float | str] | None = None,
    show: bool = False,
    axes_i: int = 0,
) -> plt.Figure:
    """Plots the cross-section.

    Parameters
    ----------
    figsize: tuple[float, float]
        Size of the plot window.
    title: str
        Title of the plot.
    font_size_title: float
        Font size of the title.
    font_size_legend: float
        Font size of the legend.
    include_legend: bool
        Include legend in the plot.
    font_size_dimension: float
        Font size of the dimensions.
    custom_text_legend: str
        Custom text for the legend.
    custom_text_width: str
        Custom text for the width dimension. Replaces the width of the cross-section with the custom text.
    custom_text_height: str
        Custom text for the height dimension. Replaces the height of the cross-section with the custom text.
    offset_line_width: float
        Offset of the width line.
    offset_line_height: float
        Offset of the height line.
    center_line_style: dict[str, float | str] | None
        Style of the center lines. Check matplotlib documentation for more information (Annotation-arrowprops).
    show: bool
        Show the plot.
    axes_i: int
        Index of the axes to plot on. Default is 0.

    Returns
    -------
    plt.Figure
        Matplotlib figure.
    """
    self._start_plot(figsize=figsize)
    self._add_rectangle(axes_i=axes_i)
    self._add_center_lines(axes_i=axes_i, style=center_line_style)
    self._add_dimension_lines(
        axes_i=axes_i,
        font_size_dimension=font_size_dimension,
        custom_text_height=custom_text_height,
        custom_text_width=custom_text_width,
        offset_line_width=offset_line_width,
        offset_line_height=offset_line_height,
    )
    self._add_stirrups(axes_i=axes_i)
    self._add_longitudinal_rebars(axes_i=axes_i)

    # set limits and title
    self.axes[axes_i].axis("off")
    self.axes[axes_i].axis("equal")
    self.axes[axes_i].set_title(
        label=title or "",
        fontdict={"fontsize": font_size_title},
    )

    if include_legend:
        self._add_legend(
            axes_i=axes_i,
            font_size_legend=font_size_legend,
            custom_legend_text=custom_text_legend,
        )
    if show:
        plt.show()  # pragma: no cover
    assert self.fig is not None
    return self.fig