sgio.plot_sg_matplotlib#

sgio.plot_sg_matplotlib(sg: StructureGene, *, ax: Any | None = None, figure_size: tuple[float, float] = (10.0, 8.0), edge_color: str = '0.5', face_color: str = '0.9', line_width: float = 0.2, show_origin: bool = True) Any#

Plot one structure-gene cross-section with matplotlib.

This is the single-section matplotlib entry point. It creates an axes when one is not supplied, draws the SG mesh in its (x2, x3) plane, and returns the axes for caller-controlled labels, model overlays, and file output. Use plot_sg_2d() when composing into an existing axes is the primary concern.

Parameters:
  • sg (StructureGene) – Structure gene containing a two-dimensional section mesh.

  • ax (matplotlib.axes.Axes, optional) – Existing axes to draw on. A new figure and axes are created by default.

  • figure_size (tuple of float, optional) – Size in inches used only when creating a new figure. Default is (10.0, 8.0).

  • edge_color (str, optional) – Mesh edge color. Default is '0.5'.

  • face_color (str, optional) – Mesh face color. Default is '0.9'.

  • line_width (float, optional) – Mesh edge line width. Default is 0.2.

  • show_origin (bool, optional) – Whether to mark the section origin. Default is True.

Returns:

Axes containing the section mesh.

Return type:

matplotlib.axes.Axes

Raises:
  • TypeError – If sg is not a StructureGene.

  • ValueError – If sg has no mesh.