Skip to content

plot

Plots on matplotlib (the plot extra).

Every function draws on ax when given, else on a new figure, and returns (fig, ax); scatter_matrix and variograms take and return a grid of axes instead, and category_colors and category_legend return what they make.

InvalidInput

histogram

histogram(
    values,
    *,
    weights=None,
    bins=40,
    log=False,
    stats=False,
    data=None,
    ax=None,
    **kwargs,
)

Histogram of relative frequencies, declustered by weights; log bins on a log axis.

Parameters:

Name Type Description Default
values str or array_like

Values; NaN is ignored.

required
weights str or array_like

Declustering weights.

None
bins int or array_like

Number of bins or their edges.

40
log bool

Log-spaced bins over the positive values and a log x axis.

False
stats bool

Write the count, weighted mean, CV and P10, P50, P90 in the upper right corner.

False
data (PointSet, BlockModel, Table or mapping)

Container whose columns values and weights may name; a block model's volumes are the default weights.

None
**kwargs

Passed to ax.hist.

required

probability

probability(
    values,
    *,
    weights=None,
    log=False,
    cap=None,
    fences=None,
    data=None,
    ax=None,
    **kwargs,
)

Cumulative probability on a normal scale: a Gaussian (or, with log, lognormal) distribution is a line.

Parameters:

Name Type Description Default
values str or array_like

Values; NaN is ignored.

required
weights str or array_like

Declustering weights.

None
log bool

Log x axis.

False
cap float

Top cut, drawn as a dashed vertical line.

None
fences float

Outlier fences P25 - fences × IQR and P75 + fences × IQR (1.5 is customary, 3 for far outliers), from weighted quartiles of the values, or of their logarithm with log; drawn as dotted vertical lines labeled with the count of values beyond each.

None
data (PointSet, BlockModel, Table or mapping)

As in histogram.

None
**kwargs

Passed to ax.plot.

required

cdf

cdf(
    values,
    *,
    weights=None,
    labels=None,
    log=False,
    stats=False,
    data=None,
    ax=None,
    **kwargs,
)

Cumulative distribution of one or several series overlaid, e.g. domains, or clustered and declustered.

Parameters:

Name Type Description Default
values str, array_like or list of them

One series, or several; NaN is ignored.

required
weights array_like or list

Declustering weights: an array for one series; for several, one array or None each.

None
labels list of str

Legend entries.

None
log bool

Log x axis.

False
stats bool

Write the count, weighted mean, CV and P10, P50, P90 of each series in the upper left corner, which a cumulative distribution leaves empty.

False
data (PointSet, BlockModel, Table or mapping)

Container whose columns values and weights may name; a block model's volumes are the default weights.

None
**kwargs

Passed to every ax.step.

required

qq

qq(
    x,
    y,
    *,
    x_weights=None,
    y_weights=None,
    quantiles=None,
    log=False,
    data=None,
    ax=None,
    **kwargs,
)

Quantiles of y against the same quantiles of x, with the 1:1 line on which equal distributions lie.

Parameters:

Name Type Description Default
x str or array_like

Two samples, e.g. one domain and another, or composites and blocks; NaN is ignored.

required
y str or array_like

Two samples, e.g. one domain and another, or composites and blocks; NaN is ignored.

required
x_weights str or array_like

Declustering weights of each.

None
y_weights str or array_like

Declustering weights of each.

None
quantiles array_like

Probabilities; default 0.01 to 0.99 in steps of 0.01.

None
log bool

Log axes.

False
data (PointSet, BlockModel, Table or mapping)

As in histogram, for both samples.

None
**kwargs

Passed to ax.plot.

required

boxplot

boxplot(
    values,
    categories,
    *,
    weights=None,
    sort=False,
    log=False,
    scheme=None,
    data=None,
    ax=None,
    **kwargs,
)

One box per category: P25 to P75, median, P10 to P90 whiskers and the mean, all weighted.

Parameters:

Name Type Description Default
values str or array_like

Values; NaN is ignored.

required
categories array_like

Category (e.g. domain) of each value, its code when scheme is given; each box is labeled with its count.

required
weights str or array_like

Declustering weights.

None
sort bool

Order boxes by median, else by category.

False
log bool

Log value axis.

False
scheme Categories

Names and colors of the categories.

None
data (PointSet, BlockModel, Table or mapping)

Container whose columns values, categories and weights may name; a block model's volumes are the default weights.

None
**kwargs

Passed to ax.bxp.

required

variogram

variogram(
    experimental,
    *,
    variogram=None,
    direction=None,
    ax=None,
    **kwargs,
)

Experimental variogram, points sized by pair count, with variogram and its sill.

Parameters:

Name Type Description Default
experimental ExperimentalVariogram
required
variogram Variogram
None
direction tuple of float

(azimuth, dip) in degrees along which an anisotropic variogram is drawn; without it, lags are taken as distances in the model's isotropic space.

None
**kwargs

Passed to ax.scatter and, for its color, to the model line.

required

variograms

variograms(
    variograms,
    *,
    model=None,
    labels=None,
    axes=None,
    **kwargs,
)

Every direct and cross variogram of a VariogramSet as a matrix of panels, with model if given.

Panel (i, j) holds the direct variogram of variable i on the diagonal and the cross variogram of i and j above it; the lower triangle is left empty. Points are sized by their share of the largest pair count, one color per direction.

Parameters:

Name Type Description Default
variograms VariogramSet
required
model Coregionalization

Drawn as C_ij(0) - C_ij(h) along each direction, or east when the set is omnidirectional.

None
labels list of str

Variable names; default the set's column names or indices.

None
axes array of Axes

(nvar, nvar) axes to draw on; default a new figure.

None
**kwargs

Passed to every ax.scatter.

required

Returns:

Name Type Description
fig Figure
axes ndarray of Axes

(nvar, nvar).

histogram_reproduction

histogram_reproduction(
    check,
    *,
    variable=0,
    scores=False,
    band=(0.0, 1.0),
    ax=None,
    **kwargs,
)

Cumulative distributions of the realizations as a band, against the declustered data's; for categories, the spread of each category's proportion across realizations against the data's.

Parameters:

Name Type Description Default
check RealizationCheck

Result of check_realizations.

required
variable int or str

Variable to draw.

0
scores bool

In the normal scores of the data, against the standard normal distribution, instead of data units.

False
band tuple of float

Quantiles across realizations bounding the band; default their full range.

(0.0, 1.0)
**kwargs

Passed to ax.fill_betweenx (ax.vlines for categories).

required

variogram_reproduction

variogram_reproduction(
    check, *, variable=0, band=(0.0, 1.0), ax=None, **kwargs
)

Experimental variograms of the realizations as a band per direction, with the data's as points and the model as a line.

Parameters:

Name Type Description Default
check RealizationCheck

Result of check_realizations with lag and max_lag.

required
variable int or str

Variable, or category for its indicator, to draw.

0
band tuple of float

Quantiles across realizations bounding each band; default their full range.

(0.0, 1.0)
**kwargs

Passed to every ax.fill_between.

required

correlation_reproduction

correlation_reproduction(
    check, *, band=(0.0, 1.0), ax=None, **kwargs
)

Correlation of each pair of variables across realizations as a range, against the declustered data's.

Parameters:

Name Type Description Default
check RealizationCheck

Result of check_realizations with several variables.

required
band tuple of float

Quantiles across realizations bounding each range; default their full range.

(0.0, 1.0)
**kwargs

Passed to ax.vlines.

required

variogram_volume

variogram_volume(
    volume,
    *,
    plane="major-semi",
    ellipse=True,
    ax=None,
    **kwargs,
)

Slice of a variogram volume through two of its principal axes, with the range ellipse.

Parameters:

Name Type Description Default
volume VariogramVolume
required
plane (major - semi, major - minor, semi - minor)

Principal axes spanning the slice, drawn along x and y.

"major-semi"
ellipse bool

Draw the range ellipse and the two axes.

True
**kwargs

Passed to ax.pcolormesh (e.g. cmap, vmax).

required

scatter

scatter(x, y, *, line=True, data=None, ax=None, **kwargs)

y against x with the 1:1 line and, if line, the least-squares regression of y on x.

The regression slope of true on estimated values below 1 flags conditional bias. x and y may name columns of data.

ternary

ternary(
    data,
    *,
    parts=None,
    labels=None,
    grid=True,
    ax=None,
    **kwargs,
)

Compositions of three parts as points in an equilateral triangle, each vertex a pure part.

Parameters:

Name Type Description Default
data (array_like, mapping, Table, PointSet or BlockModel)

(n, 3) parts, or a container holding the parts columns. Each row is closed before plotting, so the parts may be any three of a larger composition (a subcomposition).

required
parts list of 3 str

Columns of data, in vertex order: bottom left, bottom right, top.

None
labels list of 3 str

Vertex labels; default the part names.

None
grid bool

Draw lines at every 20 % of each part.

True
**kwargs

Passed to ax.scatter.

required

biplot

biplot(data, *, parts=None, labels=None, ax=None, **kwargs)

Covariance biplot of the clr coordinates: samples as points, parts as rays from the origin.

Ray length is the standard deviation of a part's clr coordinate; the distance between two ray tips is the standard deviation of the log-ratio of the two parts, so tips close together mark parts in near-constant proportion. The axes are the first two principal components, labeled with the share of total variance they hold.

Parameters:

Name Type Description Default
data (array_like, mapping, Table, PointSet or BlockModel)

(n, D) positive parts, or a container holding the parts columns; rows with a missing part are skipped.

required
parts list of str

Columns of data; default all of them.

None
labels list of str

Ray labels; default the part names.

None
**kwargs

Passed to ax.scatter.

required

correlation

correlation(
    data,
    *,
    columns=None,
    labels=None,
    weights=None,
    method="pearson",
    colorbar=True,
    ax=None,
    **kwargs,
)

Correlation, rank correlation or covariance matrix as a heatmap, each cell written out.

Parameters:

Name Type Description Default
data (array_like, mapping, Table, PointSet or BlockModel)

(n, d) values, or named columns; each pair uses the rows where both are present, as boitata.correlation does.

required
columns list of str

Columns of data to draw, in order; default all of them.

None
labels list of str

Axis labels; default the column names or indices.

None
weights array_like or str

Declustering weights, or their column in data.

None
method (pearson, spearman, covariance)

What to show; correlations span -1 to 1, covariances ± their largest magnitude.

"pearson"
colorbar bool

Add a color bar.

True
**kwargs

Passed to ax.imshow (e.g. cmap).

required

declustering

declustering(result, *, naive=None, ax=None, **kwargs)

Declustered mean against cell size, the chosen size marked, and the naive mean for reference.

Parameters:

Name Type Description Default
result Declustering

Result of boitata.cell_declustering scanning cell sizes.

required
naive float

Mean of the values without weights, drawn as a dotted line.

None
**kwargs

Passed to ax.plot.

required

conditional

conditional(
    x,
    y,
    *,
    bins=10,
    weights=None,
    log=False,
    data=None,
    ax=None,
    **kwargs,
)

Scatter of y against x with the mean and P10 to P90 of y in bins of x, drawn at each bin's median.

Parameters:

Name Type Description Default
x str or array_like

Pairs of values; pairs with NaN are ignored.

required
y str or array_like

Pairs of values; pairs with NaN are ignored.

required
bins int or array_like

Number of bins holding about as many pairs each, or bin edges of x.

10
weights str or array_like

Declustering weights.

None
log bool

Log axes; non-positive values are then ignored.

False
data (PointSet, BlockModel, Table or mapping)

Container whose columns x, y and weights may name; a block model's volumes are the default weights.

None
**kwargs

Passed to ax.scatter.

required

completeness

completeness(data, *, columns=None, ax=None, **kwargs)

Rows by number of variables present, the complete rows in the accent color, each bar labeled.

Parameters:

Name Type Description Default
data (array_like, mapping, Table, PointSet or BlockModel)

(n, d) values, or named columns; NaN is missing.

required
columns list of str

Columns of data to draw, in order; default all of them.

None
**kwargs

Passed to ax.bar.

required

scatter_matrix

scatter_matrix(
    data,
    *,
    columns=None,
    labels=None,
    weights=None,
    log=False,
    bins=30,
    axes=None,
    **kwargs,
)

Pairwise scatters of the columns of data, with their histograms on the diagonal.

Each scatter is annotated with the Pearson (r) and rank correlation of its pair, weighted by weights and over the rows where both values are present, as boitata.correlation computes them.

Parameters:

Name Type Description Default
data (array_like, mapping, Table, PointSet or BlockModel)

(n, d) values, or named columns; NaN is ignored pair by pair.

required
columns list of str

Columns of data to draw, in order; default all of them.

None
labels list of str

Axis labels; default the column names or indices.

None
weights array_like or str

Declustering weights, or their column in data, used by the histograms and the correlations.

None
log bool or sequence of bool

Log axes and bins, for every column or per column; non-positive values are then ignored.

False
bins int

Number of histogram bins.

30
axes array of Axes

(d, d) axes to draw on; default a new figure.

None
**kwargs

Passed to every ax.scatter.

required

Returns:

Name Type Description
fig Figure
axes ndarray of Axes

(d, d); axes[i, j] has column j across and column i up.

section

section(
    model,
    values,
    *,
    axis="z",
    index=None,
    plane=None,
    origin=None,
    azimuth=90.0,
    dip=90.0,
    holes=None,
    width=None,
    resolution=None,
    colorbar=True,
    scheme=None,
    ax=None,
    **kwargs,
)

Slice of a block model across axis at cell index (default: the middle), or on any plane, at true scale, with the drill holes near it projected on top.

Parameters:

Name Type Description Default
model BlockModel

Missing blocks are left blank. Drawn as true block edges (exact for masked and sub-blocked layouts) whenever the cut is normal to one of the model's own local axes: always along axis, and for an explicit plane only when it matches the model's rotation. Otherwise resampled onto a raster.

required
values str or array_like

Column name, or one value per block.

required
axis (x, y, z)

Axis normal to the slice.

"x"
index int

Cell index along axis.

None
plane tuple

(center, azimuth, dip) as in slab; replaces axis and index. The model is sampled on a raster in section coordinates.

None
origin array_like

(x, y, z) point on the plane; with azimuth and dip, the same as plane=(origin, azimuth, dip).

None
azimuth float

Bearing of the section line and dip of the plane through origin, in degrees (90 and 90: a vertical east-west section).

90.0
dip float

Bearing of the section line and dip of the plane through origin, in degrees (90 and 90: a vertical east-west section).

90.0
holes Drillholes

Traces within width of the plane, clipped to that slab, projected and labeled at their shallowest point in it.

None
width float

Full width of the slab around the plane that keeps holes; default the largest block edge.

None
resolution float

Raster step on plane; default half the smallest block edge.

None
colorbar bool

Add a color bar labeled with the column name, or a legend with scheme.

True
scheme Categories

values are codes of these categories, drawn in their colors.

None
**kwargs

Passed to ax.imshow (e.g. cmap, norm, vmin).

required

fence

fence(
    model,
    values,
    positions,
    *,
    azimuth,
    dip=90.0,
    resolution=None,
    colorbar=True,
    scheme=None,
    axes=None,
    **kwargs,
)

One vertical (or dipping) section per row of positions, on the same azimuth and dip, sharing one color scale: a fence of parallel sections stepped along a corridor.

Parameters:

Name Type Description Default
model BlockModel

As in section.

required
values str or array_like

Column name, or one value per block.

required
positions array_like

(n, 3) plane centers, one per panel, as section's plane center.

required
azimuth float

Orientation shared by every panel's plane, in degrees; dip as in section's plane (90 vertical).

required
dip float

Orientation shared by every panel's plane, in degrees; dip as in section's plane (90 vertical).

required
resolution float

Raster step on each plane; default half the smallest block edge.

None
colorbar bool

Add one color bar for every panel, labeled with the column name, or a legend with scheme.

True
scheme Categories

values are codes of these categories, drawn in their colors.

None
axes array of Axes

One per position; default a new figure.

None
**kwargs

Passed to every ax.imshow (e.g. cmap, norm, vmin, vmax).

required

Returns:

Name Type Description
fig Figure
axes ndarray of Axes

slab

slab(
    coords,
    values=None,
    *,
    plane,
    thickness,
    meshes=None,
    lines=None,
    labels=None,
    colorbar=True,
    scheme=None,
    ax=None,
    **kwargs,
)

Points within a slab around a plane, in section coordinates, with mesh traces, clipped lines and labels.

Section coordinates are world coordinates along the strike and up the dip of the plane, so a vertical east-west section reads easting and elevation, and a horizontal plane easting and northing.

Parameters:

Name Type Description Default
coords PointSet or array_like

(n, 3) coordinates.

required
values str or array_like

Column of coords, or one value per point, coloring them; default one color.

None
plane tuple

(center, azimuth, dip): a point on the plane, the bearing of the section line and the dip of the plane (90 is vertical, 0 a plan), in degrees.

required
thickness float

Full width of the slab.

required
meshes Mesh or list of Mesh

Drawn as their intersection with the plane.

None
lines list of array_like

(m, 3) polylines, e.g. drill-hole traces, clipped to the slab.

None
labels sequence of str

One per point; each distinct label is written once, above its highest point in the slab.

None
colorbar bool

With values, add a color bar labeled with the column name, or a legend with scheme.

True
scheme Categories

values are codes of these categories, drawn in their colors.

None
**kwargs

Passed to ax.scatter (e.g. s, cmap, norm, color).

required

swath

swath(swaths, *, labels=None, y='mean', ax=None, **kwargs)

Mean, tonnage or metal per slice of one or several swath results, with the first one's counts as light bars.

Parameters:

Name Type Description Default
swaths Table or list of Table

Results of boitata.swath, e.g. composites and blocks with the same width.

required
labels list of str

Legend entries.

None
y (mean, tonnage, metal)

What to draw per slice.

"mean"
**kwargs

Passed to every ax.plot.

required

category_colors

category_colors(scheme)

Color map and norm drawing code i of scheme in its color i.

Parameters:

Name Type Description Default
scheme Categories

Colors of the categories; when it has none, spread over matplotlib's image.cmap with other in gray.

required

Returns:

Name Type Description
cmap ListedColormap
norm BoundaryNorm

Boundaries at every code ± 0.5; pass both as cmap= and norm= to imshow or scatter.

category_legend

category_legend(scheme, ax, **kwargs)

Legend of scheme: one patch per category, in code order, in the colors of category_colors.

Parameters:

Name Type Description Default
scheme Categories
required
ax Axes or Figure

Where the legend goes.

required
**kwargs

Passed to ax.legend (e.g. loc, ncol).

required

Returns:

Type Description
Legend

category_swath

category_swath(
    coords,
    categories,
    width,
    *,
    azimuth=None,
    axis=None,
    weights=None,
    colors=None,
    scheme=None,
    ax=None,
    **kwargs,
)

Proportion of each category per slice along a direction, as stacked bars.

Parameters:

Name Type Description Default
coords (PointSet, BlockModel or array_like)

(n, 2) or (n, 3) coordinates; a container's columns may be named by categories and weights.

required
categories str or array_like

Category (e.g. lithology) of each sample; its code, NaN for none, when scheme is given.

required
width

Slices as in boitata.swath: width along azimuth (degrees from north) or axis ("x", "y", "z").

required
azimuth

Slices as in boitata.swath: width along azimuth (degrees from north) or axis ("x", "y", "z").

required
axis

Slices as in boitata.swath: width along azimuth (degrees from north) or axis ("x", "y", "z").

required
weights str or array_like

Declustering weights or lengths.

None
colors sequence

One color per category, sorted; default the scheme's, else spread over matplotlib's image.cmap with other in gray.

None
scheme Categories

Order, names and colors of the categories.

None
**kwargs

Passed to every ax.bar.

required

proportions

proportions(
    categories,
    *,
    weights=None,
    scheme=None,
    data=None,
    ax=None,
    **kwargs,
)

Proportion of each category as horizontal bars, weighted, with the unweighted proportions as ticks.

Parameters:

Name Type Description Default
categories array_like

Category of each sample; its code, NaN for none, when scheme is given.

required
weights str or array_like

Declustering weights or lengths; the bars are then weighted and a dark tick marks each unweighted share.

None
scheme Categories

Order, names and colors of the categories.

None
data (PointSet, BlockModel, Table or mapping)

Container whose columns categories and weights may name; a block model's volumes are the default weights.

None
**kwargs

Passed to ax.barh.

required

strip_log

strip_log(
    drillholes,
    hole,
    *,
    columns=(),
    categories=(),
    scheme=None,
    runs=None,
    ax=None,
    **kwargs,
)

Holes as vertical logs side by side: category bars, grade profiles as steps and ore runs shaded.

Parameters:

Name Type Description Default
drillholes Drillholes

With an interval table.

required
hole str or sequence of str

Hole or holes to draw, left to right.

required
columns sequence of str

Grade columns, one track each, drawn as steps from zero to the largest value over the holes drawn.

()
categories str or sequence of str

Categorical columns (e.g. lithology), one bar each.

()
scheme Categories or dict

Names and colors of the categories, or a Categories per column name; values outside it are left blank. Without one, values are sorted and spread over matplotlib's image.cmap.

None
runs Table

From Drillholes.runs; ore runs are shaded across the grade tracks.

None
**kwargs

Passed to every grade ax.plot.

required

holes

holes(
    paths,
    *,
    plane=None,
    mark=None,
    hole="HOLE_ID",
    labels=True,
    ax=None,
    **kwargs,
)

Drill-hole traces, one line per hole, in plan or projected on a section.

Parameters:

Name Type Description Default
paths Table

Result of Drillholes.paths: a hole id column, depth, x, y and z.

required
plane tuple

(center, azimuth, dip) as in section's plane; projects traces into that section instead of drawing plan-view (x, y).

None
mark array_like

(m, 3) extra points scattered on top, e.g. flagged stations from Drillholes.at.

None
hole str

Column of paths naming each row's hole.

'HOLE_ID'
labels bool

Label each hole at its shallowest row.

True
**kwargs

Passed to every ax.plot.

required

directions

directions(
    anisotropy,
    *,
    plane=None,
    thickness=None,
    ax=None,
    **kwargs,
)

Major axis of each local anisotropy as a line through its location, on a plan or a section.

Each line is the major axis projected on the view, so an axis plunging out of it draws short.

Parameters:

Name Type Description Default
anisotropy LocalAnisotropy

Locations and angles (azimuth, dip, rake).

required
plane tuple

(center, azimuth, dip) of a section as in slab; default a plan.

None
thickness float

With plane, full width of the slab of locations drawn; default all.

None
**kwargs

Passed to ax.quiver (e.g. scale, width, color).

required

paired_bias

paired_bias(bias, *, ax=None, **kwargs)

Relative bias of b over a per bin of pairing distance, with the pair counts as light bars.

Parameters:

Name Type Description Default
bias Table

Result of boitata.paired_bias.

required
**kwargs

Passed to ax.plot.

required

uncertainty_curve

uncertainty_curve(
    curve, *, threshold=0.15, required=None, ax=None
)

Uncertainty quantiles against data spacing, the share within threshold on the right axis.

Parameters:

Name Type Description Default
curve Table

Result of boitata.uncertainty_curve; its P... columns are drawn, the first solid, the rest dashed.

required
threshold float

Acceptable uncertainty, drawn as a horizontal line.

0.15
required float

Required spacing, e.g. from boitata.required_spacing, marked on the threshold line.

None

grade_tonnage

grade_tonnage(table, *, relative=False, ax=None, **kwargs)

Tonnage (solid) and mean grade (dashed, right axis) above cutoff, for one curve or several in one color each.

Parameters:

Name Type Description Default
table Table or dict of str to Table

Result of boitata.grade_tonnage, HermiteAnamorphosis.grade_tonnage, UniformConditioning.grade_tonnage, boitata.compare_models or SimulationSummary.grade_tonnage; rows are split into curves by their model and category columns. A dict names several such tables. With a probability column, each curve is drawn at the probability nearest 0.5, in a band between the lowest and highest.

required
relative bool

Tonnage as a fraction of each curve's tonnage at its lowest cutoff, to compare samples with blocks.

False
**kwargs

Passed to every ax.plot.

required

cross_validation

cross_validation(
    cv, *, kind="scatter", coords=None, ax=None, **kwargs
)

Cross-validation as actual against estimate, as an accuracy plot, or as its errors.

Parameters:

Name Type Description Default
cv CrossValidation or IndicatorCrossValidation

Result of cross_validate.

required
kind (scatter, accuracy, errors)

"scatter": actual against estimate with the 1:1 line, the regression of actual on estimate (a slope below 1 is conditional bias) and the statistics. "accuracy": fraction of samples inside their symmetric p-probability interval against p, with the goodness statistic; on or above the diagonal is accurate. Kriging takes the Gaussian interval of its estimate and variance, indicator kriging its corrected distribution. "errors": estimate minus actual mapped at coords, or without them a histogram.

"scatter"
coords PointSet or array_like

Sample locations for the error map, in the order given to fit.

None
**kwargs

Passed to ax.scatter (scatter, error map), ax.plot (accuracy) or ax.hist (histogram).

required

contact

contact(
    table,
    *,
    labels=("inside", "outside"),
    ax=None,
    **kwargs,
)

Mean grade against signed distance to a contact, the sample counts as light bars; a jump at zero is a hard contact, a gradual change a soft one.

Parameters:

Name Type Description Default
table Table

Result of boitata.contact; negative distances are inside.

required
labels tuple of str

Names of the inside and outside domains, written on either side.

('inside', 'outside')
**kwargs

Passed to ax.plot.

required

domain_change

domain_change(
    table,
    *,
    value="tonnage",
    relative=False,
    fmt=None,
    ax=None,
    **kwargs,
)

Cross-table of two categorical models as a matrix, rows the first model's classes, columns the second's, each cell labeled with its value. The diagonal, what is unchanged, is outlined and left blank so the grays scale to what moves.

Parameters:

Name Type Description Default
table Table

Result of boitata.domain_change.

required
value str

Column to show: "tonnage", "metal" or "mean_grade".

'tonnage'
relative bool

Each row as a fraction of its total: the share of each class of the first model going to each class of the second (not with "mean_grade").

False
fmt str

Format of the cell labels; default "{:.0%}" when relative, else "{:,.3g}".

None
**kwargs

Passed to ax.imshow.

required

transition_mds

transition_mds(table, *, ax=None, **kwargs)

Classical (Torgerson) MDS of an along-hole transition table: categories that transition into each other most often sit close together in 2D.

The frequency column, one class's row shares, is symmetrized into a dissimilarity, 1 - (freq + freq.T) / 2, then scaled from the top two eigenvectors of its double-centered squared distances.

Parameters:

Name Type Description Default
table Table

Result of boitata.transition_matrix.

required
**kwargs

Passed to ax.scatter.

required

uncertain

uncertain(
    values,
    uncertainty,
    *,
    model=None,
    axis="z",
    index=None,
    plane=None,
    resolution=None,
    extent=None,
    cmap=None,
    norm=None,
    scheme=None,
    label=None,
    legend_ax=None,
    ax=None,
)

Image whose color gives a value and whose fading towards white gives how uncertain it is.

The legend is a fan: the value runs across its angle, certainty along its radius, from white at the center (uncertain) to the full color on the arc (certain).

Parameters:

Name Type Description Default
values str or array_like

2D image, e.g. the mean of the realizations on a section; NaN is left blank. With model, a column name or one value per block.

required
uncertainty str or array_like

Same shape as values, from 0 (certain) to 1 (no information), e.g. the realizations' standard deviation over the global one. Clipped to [0, 1].

required
model BlockModel

Slice it as section does; missing blocks are left blank.

None
axis (x, y, z)

With model, axis normal to the slice.

"x"
index int

With model, cell index along axis (default: the middle).

None
plane tuple

With model, (center, azimuth, dip) as in slab, replacing axis and index.

None
resolution float

Raster step on plane; default half the smallest block edge.

None
extent tuple of float

Passed to ax.imshow; set from model when given.

None
cmap str or Colormap

Default: matplotlib's image.cmap.

None
norm Normalize

Maps values to [0, 1]; default spans their range.

None
scheme Categories

values are codes of these categories (e.g. the most likely one), drawn in their colors and keyed by a legend instead of the fan; replaces cmap and norm.

None
label str

Value name written under the legend, or its title with scheme.

None
legend_ax Axes

Where to draw the legend; default below ax.

None

describe builtin

describe(
    values, *, weights=None, quantiles=Ellipsis, data=None
)

Weighted (declustered) statistics of values; NaN is skipped.

Parameters:

Name Type Description Default
values array_like or str

Values, or their column in data.

required
weights array_like or str

Declustering weights; default the volumes of a BlockModel data, else 1.

None
quantiles sequence of float

Probabilities of the quantile keys.

Ellipsis
data (PointSet, BlockModel, Table or dict)

Where column names are looked up.

None

Returns:

Type Description
dict

n, mean, variance, std, cv, min, max and one key per quantile named P10, P97.5, ... (mid-point cumulative weights).

normal_cdf builtin

normal_cdf(x)

Standard normal CDF.

normal_ppf builtin

normal_ppf(p)

Standard normal quantile function.

used in