Skip to content

Index

subsurfaceio.geotech_plot

Geotechnical plotting API.

Wraps the general-purpose plotting layer with the conventions geotechnical plots need: reversed depth axes, per-parameter axis scales, data-bin bands, and categorical strata drawn as colored layers.

Following subsurfaceio.plot, this package exports only the configuration models; each backend figure comes from its own module:

from subsurfaceio.geotech_plot.figure_plotly import GeotechFigure
from subsurfaceio.plot import Line

fig = GeotechFigure(
    reverse_y=True,
    plot_model=Line(plot_type='line', data_frame=df, x='cone_tip_resistance', y='depth'),
).plot().fig

GeotechFigure is the matplotlib equivalent and requires the mpl extra.

Modules:

Name Description
base

Shared configuration for geotechnical figures.

figure_mpl

Matplotlib renderer for geotechnical figures.

figure_plotly

Plotly renderer for geotechnical figures.

mixins

Geotechnical figure mixins for axes, styling, strata, and data-bin shapes.

Classes:

Name Description
AxisMap

How to scale and bound the axis a given parameter is drawn on.

StyleMap

Line and marker styling for one named trace.

Attributes:

Name Type Description
DEFAULT_AXIS_MAP dict[str, AxisMap]

Conventional axis treatment for parameters that need a non-default scale.

DEFAULT_AXIS_MAP module-attribute

DEFAULT_AXIS_MAP: dict[str, AxisMap] = {
    "material_index": AxisMap(
        type="log", autorange=False, range=(-1, 1)
    ),
    "soil_behavior_type_index": AxisMap(
        autorange=False, range=(1, 4)
    ),
    "modified_soil_behavior_type_index": AxisMap(
        type="log", autorange=False, range=(1, 2)
    ),
    "permeability": AxisMap(type="log"),
    "coefficient_of_consolidation": AxisMap(type="log"),
    "soil_classification_index": AxisMap(
        type="log", autorange=False, range=(1, 2.69897)
    ),
}

Conventional axis treatment for parameters that need a non-default scale.

GeotechFigureT module-attribute

GeotechFigureT: TypeAlias = (
    PlotlyGeotechFigure | MplGeotechFigure
)

AxisMap pydantic-model

Bases: BaseModel

How to scale and bound the axis a given parameter is drawn on.

Attributes:

Name Type Description
type Literal['linear', 'log', 'category']

Axis scale.

rangemode Literal['normal', 'tozero', 'nonnegative']

How the automatic range treats zero.

autorange AutoRange

Automatic range behavior. False honors range.

range tuple[float, float] | None

Lower and upper bound, or None to leave the range automatic. For a logarithmic axis these are exponents, matching Plotly, so (-1, 1) spans 0.1 to 10. To pin only one end, use the matching autorange value instead.

Fields:

  • type (Literal['linear', 'log', 'category'])
  • rangemode (Literal['normal', 'tozero', 'nonnegative'])
  • autorange (AutoRange)
  • range (tuple[float, float] | None)

autorange pydantic-field

autorange: AutoRange = True

mpl_lim property

mpl_lim: tuple[float, float] | None

range converted to data coordinates for matplotlib.

Plotly takes logarithmic bounds as exponents while matplotlib takes them as data values, so exponents are raised here.

Returns:

Type Description
tuple[float, float] | None

Axis limits in data coordinates, or None when unset.

range pydantic-field

range: tuple[float, float] | None = None

rangemode pydantic-field

rangemode: Literal["normal", "tozero", "nonnegative"] = (
    "normal"
)

type pydantic-field

type: Literal['linear', 'log', 'category'] = 'linear'

StyleMap pydantic-model

Bases: BaseModel

Line and marker styling for one named trace.

Expressed in Plotly terms and translated for matplotlib by mpl_props. Color, dash, and symbol are deliberately absent: those are handled through the express color_discrete_map, line_dash_map, and symbol_map arguments instead, which support both backends natively.

Attributes:

Name Type Description
mode TraceMode | None

Whether to draw lines, markers, or both.

marker_size float | None

Marker size in points.

line_shape LineShape | None

Interpolation between points.

line_width float | None

Line width in points.

Fields:

line_shape pydantic-field

line_shape: LineShape | None = 'linear'

line_width pydantic-field

line_width: float | None = None

marker_size pydantic-field

marker_size: float | None = None

mode pydantic-field

mode: TraceMode | None = None

mpl_props property

mpl_props: dict[str, object]

Equivalent matplotlib Line2D properties.

Unset attributes are omitted rather than passed as None, which some matplotlib setters reject.

Returns:

Type Description
dict[str, object]

Keyword arguments for Line2D.set.