Plot
Mojo struct 🡭
Plot
@memory_only
struct PlotThe entry point: what a chart is before its mark is chosen.
Fields
- settings (
_ChartSettings) - style (
_MarkStyle) - annotations (
_AnnotationData) - width (
Int) - height (
Int)
Implemented traits
AnyType, Copyable, Deinitable, Movable
Methods
__init__
fn def __init__(out self)Args:
- self (
Self)
Returns:
Self
theme
fn def theme(var self, t: Theme) -> SelfArgs:
- self (
Self) - t (
Theme)
Returns:
Self
size
fn def size(var self, width: Int, height: Int) -> SelfSet the dimensions render()/render_svg()/save() construct their target at. Defaults to 640x420.
The unit is a point, 1/72 inch, which is what makes a figure
size mean something physical (#372). On the raster backends one
point is one pixel at the default resolution, so nothing about
the old reading changes; save(..., dpi=300) keeps the physical
size and multiplies the pixels. In a PDF it is a point on the
page. size_inches()/size_mm() say the same thing in the
units a page is usually specified in.
Args:
- self (
Self) - width (
Int): Figure width in points. - height (
Int): Figure height in points.
Returns:
Self: Self, for further chaining.
size_inches
fn def size_inches(var self, width: Float64, height: Float64) -> Selfsize() in inches: 72 points to the inch, rounded to whole points (#372).
A figure for a journal column or a slide is specified
physically, and size(468, 312) does not read as “6.5 by 4.3
inches” to anyone.
Args:
- self (
Self) - width (
Float64): Figure width in inches. - height (
Float64): Figure height in inches.
Returns:
Self: Self, for further chaining.
size_mm
fn def size_mm(var self, width: Float64, height: Float64) -> Selfsize() in millimeters: 25.4 mm to the inch and 72 points to the inch, rounded to whole points (#372).
Args:
- self (
Self) - width (
Float64): Figure width in millimeters. - height (
Float64): Figure height in millimeters.
Returns:
Self: Self, for further chaining.
tooltips
fn def tooltips(var self, policy: Tooltips) -> SelfSet whether this chart’s data get SVG hover tooltips, overriding Theme.tooltips for this plot only. Tooltips.ON titles every datum, Tooltips.OFF none, and Tooltips.AUTO titles them when there are at most Theme.auto_tooltip_limit (tooltips.mojo). Precedence is this call, then the theme.
Tooltips.ON on a mark without tooltips raises when the chart
renders; which marks have them is
MarkType.supports_tooltips.
Args:
- self (
Self) - policy (
Tooltips):Tooltips.ON,Tooltips.OFForTooltips.AUTO.
Returns:
Self: Self, for further chaining.
labels
fn def labels(var self, title: String = "", subtitle: String = "", x_title: String = "", y_title: String = "", description: String = "") -> SelfSet the chart title/subtitle and/or axis titles. Named x_title/ y_title rather than x/y so a call next to .encode(x=..., y=...) never reads as setting data.
Each is independent and defaults to "" (not set); layout space is
reserved only for the non-empty visible ones (title/subtitle/
x_title/y_title – description draws nothing). subtitle
draws directly beneath title, smaller and in Theme.subtitle_color;
with no title it draws at the top position title would have used.
x_title/y_title caption whatever is drawn along the bottom/left
edge, whichever axis that is for the mark’s orientation. Mark.ARC
has no axes, so x_title/y_title raise at render() time there;
only title/subtitle/description apply.
description is an SVG <desc> – longer, screen-reader-only
context subtitle alone can’t carry since it’s drawn on the chart
itself. save()/save_layers()/save_facets() write it (falling
back to subtitle when empty) automatically whenever title is set;
see accessible_svg_string()’s own docstring for the full markup.
Any of the four drawn labels may hold mathematics between $
signs: "$\sigma^2$", "Rate $\frac{\Delta y}{\Delta x}$".
Inside the dollars, Latin letters and lowercase Greek are italic
variables and everything else upright; ^ and _ attach
scripts, \frac{}{} stacks a fraction, \sqrt{} draws a
radical, \mathrm{} forces upright text, and
\alpha…\Omega and operators such as \times, \leq
and \sum name symbols – the full list is in
dataviz/core/mathtext.mojo. A lone $ is a price and stays
plain; write \$ for a literal one beside math. The space an
expression needs above and below the line is measured and
reserved. A label that does not parse raises at render time,
naming the label and the character, rather than drawing a
guess.
Args:
- self (
Self) - title (
String): The chart’s title. Left empty (the default), reserves no layout space for it. - subtitle (
String): A secondary line shown under the title, independent of whethertitleis also set. - x_title (
String): Caption for whatever’s drawn along the bottom edge; raises at render() time onMark.ARC. - y_title (
String): Caption for whatever’s drawn along the left edge; raises at render() time onMark.ARC. - description (
String): Optional longer SVG<desc>text, drawn nowhere on the chart itself; falls back tosubtitlewhen left empty.
Returns:
Self: Self, for further chaining.
series_name
fn def series_name(var self, name: String) -> SelfName this layer for render_layers()’s/render_layers_svg()’s per-layer legend: a swatch (this layer’s own Theme.mark_color) plus name, one row per named layer, drawn before any per-point color/color_categories legend a Mark. POINT layer has of its own. A Plot.secondary_axis() layer’s row gets " (right axis)" appended, so the reader knows which axis it reads against.
render_layers()/render_layers_svg() and
_render_bar_combo_layers (the Mark.BAR-combo path) only;
render()/render_svg() ignore it, since a standalone plot has
only one series, nothing for a legend entry to distinguish.
Layers with no name draw no row.
See the Cookbook’s own “Layer Legend” recipe (docs/src/ cookbook_recipes/layer_legend.mojo) for a full worked example.
Args:
- self (
Self) - name (
String): This layer’s label in the per-layer legend. Left empty (the default, via not calling this), the layer draws no legend row.
Returns:
Self: Self, for further chaining.
annotate_line
fn def annotate_line(var self, value: Float64, label: String = "") -> SelfAdd a horizontal reference line at value on the y-axis (ECharts’ markLine with a fixed value; no auto-computed average/max/min modes). Each call adds a line. label, when non-empty, draws to the right of the line in Theme.annotation_color; the line spans the full plot width, solid (canvas has no dashed-stroke primitive). A value outside the mark’s padded y-domain draws nothing.
Only meaningful on a mark whose y-axis is a continuous
LinearScale, checked at render() time via
_RenderResult.has_y_scale: Mark.POINT/LINE/AREA/
EFFECT_SCATTER and every mark sharing _CategoricalFrame (BAR/
LOLLIPOP/WATERFALL/BOX/CANDLESTICK/BULLET/GROUPED_BAR/
STACKED_BAR/STREAMGRAPH). Other marks raise. Also wired into
render_facets() (per cell) and render_layers() (per layer,
against that layer’s own primary or secondary y-scale).
See the Cookbook’s own “Reference Line” recipe (docs/src/ cookbook_recipes/annotate_line.mojo) for a full worked example.
Args:
- self (
Self) - value (
Float64): The y-value to draw the line at. Outside the mark’s (padded) y-domain, draws nothing. - label (
String): Drawn to the right of the line when non-empty; left empty (the default), the line draws with no label.
Returns:
Self: Self, for further chaining – render()/render_svg()
raise later if the mark has no genuine continuous y-axis.
annotate_area
fn def annotate_area(var self, y0: Float64, y1: Float64, label: String = "") -> SelfAdd a shaded horizontal band from y0 to y1 on the y-axis (ECharts’ markArea with a fixed pair). Each call adds a band. label, when non-empty, draws inside the band near its top edge in Theme.annotation_color. y0/y1 may be given in either order.
A band partially overlapping the mark’s padded y-domain clips to the
visible portion; one with no overlap draws nothing. Drawn on top of
the mark at Theme.annotation_area_color’s partial opacity, so the
mark’s ink shows through.
Same mark support and facets/layers wiring as annotate_line().
See the Cookbook’s own “Reference Band” recipe (docs/src/ cookbook_recipes/annotate_area.mojo) for a full worked example.
Args:
- self (
Self) - y0 (
Float64): One edge of the band; need not be the lower one. - y1 (
Float64): The other edge of the band; whichever ofy0/y1is smaller becomes the band’s bottom edge. - label (
String): Drawn inside the band near its top edge when non-empty; left empty (the default), the band draws with no label.
Returns:
Self: Self, for further chaining – render()/render_svg()
raise later if the mark has no genuine continuous y-axis.
annotate_vline
fn def annotate_vline(var self, value: Float64, label: String = "") -> SelfAdd a vertical reference line at value on the x-axis: annotate_line()’s mirror image, with the same fixed-value scope, additive behavior, styling, and out-of-domain skip.
Narrower mark support: only Mark.POINT/LINE/AREA/
EFFECT_SCATTER, the marks with a continuous x-axis; a categorical
x-axis has no numeric value to place a line against (see
_RenderResult). Raises on an unsupported mark. Also wired into
render_facets() (per cell) and render_layers() (per layer,
against the one shared continuous x-scale every layer uses –
raises on a Mark.BAR combo chart’s categorical x-axis instead,
same as a standalone unsupported mark).
See the Cookbook’s own “Vertical Reference Line” recipe (docs/ docs/cookbook_recipes/annotate_vline.mojo) for a full worked example.
Args:
- self (
Self) - value (
Float64): The x-value to draw the line at. Outside the mark’s (padded) x-domain, draws nothing. - label (
String): Drawn near the line when non-empty; left empty (the default), the line draws with no label.
Returns:
Self: Self, for further chaining – render()/render_svg()
raise later if the mark has no genuine continuous x-axis.
annotate_point
fn def annotate_point(var self, x: Float64, y: Float64, label: String = "") -> SelfAdd a single labeled point at (x, y) (ECharts’ markPoint with a fixed coordinate): a small filled marker in Theme.annotation_color, with label just above it when non-empty. Each call adds a point.
Needs a continuous coordinate on both axes, so only Mark.POINT/
LINE/AREA/EFFECT_SCATTER support it; raises otherwise. A point
outside the padded domain on either axis draws nothing. Also wired
into render_facets() (per cell) and render_layers() (per layer,
against that layer’s own primary or secondary y-scale and the one
shared x-scale).
See the Cookbook’s own “Point Marker” recipe (docs/src/ cookbook_recipes/annotate_point.mojo) for a full worked example.
Args:
- self (
Self) - x (
Float64): The point’s x-coordinate. Outside the mark’s (padded) x-domain, draws nothing. - y (
Float64): The point’s y-coordinate. Outside the mark’s (padded) y-domain, draws nothing. - label (
String): Drawn just above the point when non-empty; left empty (the default), the point draws with no label.
Returns:
Self: Self, for further chaining – render()/render_svg()
raise later if the mark has no genuine continuous x/y-axis.
annotate_arrow
fn def annotate_arrow(var self, x: Float64, y: Float64, text: String, text_x: Float64, text_y: Float64) -> SelfPoint at (x, y) with an arrow, labeled text placed at (text_x, text_y). Each call adds an arrow.
This is the only annotation that can be placed in empty space,
which is what makes it usable on a crowded chart where every
other overlay lands on data – annotate_point()’s label sits a
fixed gap above its marker and cannot be moved. An arrow is
often the whole point of a chart going into a document: it is
what turns a plot into an argument.
Both ends are in data coordinates. Everything else in this API is in data space, and a second convention would need explaining every time it appeared. The cost is that a label position has to be chosen against the data’s own range; the benefit is that it stays put when the chart is resized.
Straight arrows only. Curved connectors, head styles and shrink factors are refinements on top of a feature that did not exist; the straight case carries most of the value.
Needs a continuous coordinate on both axes, so only Mark.POINT/
LINE/AREA/EFFECT_SCATTER support it; raises otherwise. An
arrow with either end outside the padded domain is skipped
whole rather than clipped – half an arrow points at nothing.
Args:
- self (
Self) - x (
Float64): The target’s x-coordinate, where the head lands. - y (
Float64): The target’s y-coordinate. - text (
String): The label, drawn centered at(text_x, text_y). Empty draws the arrow alone. - text_x (
Float64): The label’s x-coordinate, in data space. - text_y (
Float64): The label’s y-coordinate, in data space.
Returns:
Self: Self, for further chaining – render()/render_svg()
raise later if the mark has no genuine continuous x/y-axis.
annotate_band
fn def annotate_band(var self, x: List[Float64], y_lower: List[Float64], y_upper: List[Float64], label: String = "") -> SelfShade the region between two curves that vary with x: a confidence band around a trend line, or a min/max envelope. annotate_area()’s band is a constant (y0, y1) pair; this takes two parallel lists keyed by x. Each call adds a band.
x/y_lower/y_upper must be the same length and every
y_upper[i] >= y_lower[i], both checked at render() time. x need
not be sorted; the top edge traces (x[i], y_upper[i]) in order and
the bottom edge walks back in reverse.
Filled in Theme.annotation_area_color with straight edges (no
Theme.line_smoothing). label, when non-empty, centers above the
band’s middle x-index on its upper edge.
Only Mark.POINT/LINE/AREA/EFFECT_SCATTER, as for
annotate_point(). A band is clipped to the overlapping range on
both axes; one with no overlap draws nothing. Same facets/layers
wiring as annotate_point().
See the Cookbook’s own “Confidence Band” recipe (docs/src/ cookbook_recipes/annotate_band.mojo) for a full worked example.
Args:
- self (
Self) - x (
List[Float64]): The band’s x column, one entry per (y_lower,y_upper) pair, in the order the edges should trace. - y_lower (
List[Float64]): The band’s bottom edge, one entry perx. - y_upper (
List[Float64]): The band’s top edge, one entry perx; every value must be>= y_lower’s value at that same index. - label (
String): Drawn centered above the band’s middle point when non-empty; left empty (the default), the band draws with no label.
Returns:
Self: Self, for further chaining – render()/render_svg()
raise later if the lengths mismatch, an upper/lower value
is inverted, or the mark has no genuine continuous x/y-axis.
annotate_best_fit
fn def annotate_best_fit(var self, show_equation: Bool = False, show_r_squared: Bool = False, label: String = "", ci: Float64 = 0.94999999999999996) -> SelfOverlay an ordinary-least-squares best-fit line computed from this plot’s own _continuous.x/_continuous.y at render() time, so it works whether called before or after .encode(). Not additive: the last call wins, since the fit is determined by the data.
Drawn as a solid line in Theme.annotation_color across the mark’s
full padded x-domain. show_equation/show_r_squared each add one
line of text right-aligned near the plot’s top-right corner; label,
when non-empty, draws as a heading above them. R-squared is
1 - SS_res/SS_tot, defined as 1.0 when SS_tot is 0.0.
Only Mark.POINT/LINE/AREA/EFFECT_SCATTER. Raises at render()
time with fewer than 2 points or when every x value is identical.
Also wired into render_facets() (per cell, fit to that cell’s own
data) and render_layers() (per layer, fit to that layer’s own
data against its primary or secondary y-scale and the shared
x-scale).
See the Cookbook’s own “Best-Fit Trend Line” recipe (docs/src/ cookbook_recipes/best_fit_line.mojo) for a full worked example.
Args:
- self (
Self) - show_equation (
Bool): Draw the fitted line’s owny = mx + btext whenTrue;False(the default) draws only the line itself. - show_r_squared (
Bool): Draw the fit’s R-squared text whenTrue;False(the default) omits it. - label (
String): An optional heading drawn above the equation/ R-squared text; left empty (the default), no heading draws (independent ofshow_equation/show_r_ squared– alabelwith both leftFalsestill draws only the line, no text at all). - ci (
Float64): Two-sided confidence level for a band around the fitted line.0.95(the default) shades the 95% confidence interval of the fitted mean at each x; pass0.0for the bare line. The band is narrowest at the mean ofxand flares toward the ends, which is the point of drawing it: a line without one invites the reader to trust the slope more than the data supports (#352). Levels carried: 0.90, 0.95, 0.99. A band needs three points – with two, the line passes through both and there is no residual error to size it from – so with fewer the line draws alone. Drawn inTheme.annotation_area_color, under the line.
Returns:
Self
annotate_smooth
fn def annotate_smooth(var self, method: SmoothMethod = SmoothMethod.LOESS, span: Float64 = 0.75, degree: Int = Int(2)) -> SelfOverlay a curved trend line fitted to this plot’s own x/y data (#147) – annotate_best_fit()’s straight line, for data a straight line does not describe.
SmoothMethod.LOESS(the default): locally weighted regression. At each x, a polynomial ofdegree(1 or 2) is fitted to the nearestspanshare of the points, weighted by the tricube of their distance, and evaluated there.spansets how smooth: smaller follows the data more closely. The defaults,span=0.75anddegree=2, are the conventional ones for local regression.SmoothMethod.POLYNOMIAL: one least-squares polynomial ofdegreeover every point;spanis unused.
Drawn across the data’s own x range, in annotate_best_fit()’s
color and line style, clipped to the plot area. Unlike
annotate_best_fit() there is no confidence band, equation or
R-squared: those are defined for the straight-line fit.
Args:
- self (
Self) - method (
SmoothMethod):SmoothMethod.LOESSorSmoothMethod.POLYNOMIAL. - span (
Float64): LOESS’s window as a share of the points, in(0, 1]. - degree (
Int): LOESS’s local degree (1 or 2), or the polynomial’s.
Returns:
Self: Self, for further chaining – render()/render_svg() raise
later if the mark has no continuous x/y axes, or the data
cannot support the fit (too few points or distinct x values
for the degree, or a span outside (0, 1]).
scale_y_log
fn def scale_y_log(var self) -> SelfScale the y-axis logarithmically (base 10). Every y value, and every y-axis annotation value, must be strictly positive; render()/ render_svg() raise otherwise (see _log_data_extent()).
Mark.POINT/LINE/EFFECT_SCATTER only, and standalone render()/
render_svg() only: a categorical mark has no continuous y-domain,
Mark.AREA’s y-domain is forced through zero (which has no
logarithm), and render_layers() combines layers into one linear
scale. Every tick/gridline/point/annotation still goes through
LinearScale.to_pixel() with real-unit values; see that method.
See the Cookbook’s own “Log Scale (Y-Axis)” recipe (docs/src/ cookbook_recipes/log_scale_y.mojo) for a full worked example.
Args:
- self (
Self)
Returns:
Self: Self, for further chaining.
scale_x_log
fn def scale_x_log(var self) -> Selfscale_y_log()’s x-axis mirror. Mark.POINT/LINE/AREA/ EFFECT_SCATTER (x is never forced through zero, so AREA is allowed here), standalone render()/render_svg() only.
See the Cookbook’s own “Log Scale (X-Axis)” recipe (docs/src/ cookbook_recipes/log_scale_x.mojo) for a full worked example.
Args:
- self (
Self)
Returns:
Self: Self, for further chaining.
scale_y_symlog
fn def scale_y_symlog(var self, linthresh: Float64 = 1) -> SelfScale the y-axis symmetrically logarithmically: linear within [-linthresh, linthresh], logarithmic beyond it, continuous where they meet (#368).
What scale_y_log() cannot do. A log axis needs strictly
positive values, so a series that crosses zero – a temperature
anomaly, a profit and loss, a residual – cannot go on one at
all; and a linear axis collapses every small value against the
largest. Symlog keeps zero, keeps the sign, and still resolves
several orders of magnitude on each side.
linthresh is the half-width of the linear region in data
units, and must be positive. It sets what counts as “near
zero”: values inside it are laid out linearly, so the noise
floor of the measurement is usually the right choice. The
linear region takes exactly as much axis as one decade of the
logarithmic region, which is the only ratio that makes the two
halves comparable without a second knob.
Mark.POINT/LINE/AREA/EFFECT_SCATTER, standalone
render()/render_svg() only, the same scope
scale_y_log() has. Mutually exclusive with scale_y_log();
setting both raises at render time rather than silently
preferring one.
Args:
- self (
Self) - linthresh (
Float64): Half-width of the linear region around zero, in data units. Must be positive.
Returns:
Self: Self, for further chaining.
scale_x_symlog
fn def scale_x_symlog(var self, linthresh: Float64 = 1) -> Selfscale_y_symlog()’s x-axis mirror, with the same scope and the same linthresh meaning (#368).
Args:
- self (
Self) - linthresh (
Float64): Half-width of the linear region around zero, in data units. Must be positive.
Returns:
Self: Self, for further chaining.
scale_x_domain
fn def scale_x_domain(var self, min: Float64, max: Float64) -> SelfPin the x-axis domain to the given minimum and maximum, replacing _data_extent()’s 5%-padded domain (or _log_data_extent()’s when scale_x_log() is also set). For comparable charts across runs, a fixed reference range, or a zoomed-in view, without padding the data with fake points.
Mark.POINT/LINE/AREA/EFFECT_SCATTER only (the same marks
_render_generic’s continuous path draws), standalone render()/
render_svg() and render_facets() only – render_layers()
raises if any layer sets this, since a shared axis across several
layers needs one shared answer, not one per layer; the categorical
marks (Mark.BAR, LOLLIPOP, …) raise too, left for a
supported. render_facets() applies this per cell, so every cell
sharing the same override reads as one shared domain – the
facets counterpart to shared_y_scale=True for the x-axis (which
has no shared_y_scale equivalent otherwise).
A point outside the domain still computes a real (off-plot)
pixel position via LinearScale.to_pixel(), same as it would if
it merely fell outside a padded auto-computed domain; the SVG
viewBox’s own default overflow: hidden clips it at the canvas
edge, and the raster Canvas’s own pixel buffer bounds-checks
every draw call, so nothing paints outside the plot in either
backend.
Args:
- self (
Self) - min (
Float64): The domain’s lower bound. For a log x-axis (scale_x_log()), must be> 0. - max (
Float64): The domain’s upper bound; must be> min.
Returns:
Self: Self, for further chaining – render()/render_svg()
raise later if min >= max, the mark doesn’t support this,
or (with scale_x_log()) min <= 0.
scale_y_domain
fn def scale_y_domain(var self, min: Float64, max: Float64) -> Selfscale_x_domain()’s y-axis mirror – see that method’s own docstring for the shared rules. Overrides _zero_baseline_y_ extent()’s forced-zero domain on Mark.AREA too: an explicit The explicit domain is used exactly, zero baseline or not.
Args:
- self (
Self) - min (
Float64): The domain’s lower bound. For a log y-axis (scale_y_log()), must be> 0. - max (
Float64): The domain’s upper bound; must be> min.
Returns:
Self: Self, for further chaining – render()/render_svg()
raise later if min >= max, the mark doesn’t support this,
or (with scale_y_log()) min <= 0.
scale_x_ticks
fn def scale_x_ticks(var self, values: List[Float64], labels: List[String] = List()) -> SelfPut the x-axis major ticks exactly at values, instead of at the 1-2-5 positions the axis would choose (#368).
For an axis whose meaningful positions are not round numbers: a threshold, a target, the two dates a study ran between. The gridline, the tick mark and the label all move together, because they are one tick.
labels replaces the formatted numbers when given, one per
position, which is how an axis reads Q1 Q2 Q3 Q4 over values
that are really 1 2 3 4. Left empty, the positions are
formatted the way computed ticks are, at one decimal count for
the whole set.
A position outside the axis domain is dropped rather than drawn:
its pixel would fall outside the plot rect and its label would
print in the margin beside nothing. scale_x_domain() is what
moves the domain; this only says where the ticks go inside it.
Minor ticks are not derived from an explicit set, since the caller said where the ticks belong and a subdivision of an irregular set has no meaning.
Args:
- self (
Self) - values (
List[Float64]): Tick positions, in the axis’s own units. - labels (
List[String]): One label per position, or empty to format the positions.
Returns:
Self: Self, for further chaining – render()/render_svg()
raise later if the list is empty, a label count does not
match, a position is not finite, a position is not positive
on a log axis, or the mark does not support this.
scale_y_ticks
fn def scale_y_ticks(var self, values: List[Float64], labels: List[String] = List()) -> Selfscale_x_ticks()’s y-axis mirror – see that method’s docstring for the shared rules.
The y labels are what the left margin is measured from, so an explicit set widens or narrows the plot rect to fit itself, exactly as computed labels do.
Args:
- self (
Self) - values (
List[Float64]): Tick positions, in the axis’s own units. - labels (
List[String]): One label per position, or empty to format the positions.
Returns:
Self: Self, for further chaining – see scale_x_ticks().
scale_x_reverse
fn def scale_x_reverse(var self) -> SelfRun the x-axis right to left: the domain’s low end lands on the plot rect’s right edge (#368).
For a quantity that reads better descending – a rank where 1 is best, a countdown, a depth below a surface. Only the two pixel positions swap. The domain stays ascending, so the ticks are the same ticks in the same order and every mark keeps handing the scale the same values; what changes is where they land.
Args:
- self (
Self)
Returns:
Self: Self, for further chaining – render()/render_svg()
raise later if the mark does not support this.
scale_y_reverse
fn def scale_y_reverse(var self) -> SelfRun the y-axis top to bottom: the domain’s low end lands on the plot rect’s top edge (#368).
scale_x_reverse()’s mirror. On Mark.IMSHOW, whose y-axis
already counts downward so that row 0 is at the top, this
composes rather than competes: it puts row 0 back at the bottom.
Args:
- self (
Self)
Returns:
Self: Self, for further chaining – see scale_x_reverse().
equal_aspect
fn def equal_aspect(var self) -> SelfGive one data unit the same pixel length on both axes (#368).
For anything whose two axes are the same kind of quantity, where the shape of what is drawn is part of what it says: a map, a circle that has to look round, a residual plot read against the 45-degree line.
The plot rect shrinks; the domains do not grow. With equal aspect something has to give, and the two choices are showing a wider range than the caller asked for or leaving part of the figure empty. This leaves space: the rect keeps the aspect the data implies and centers itself in the room it had. Nothing is drawn outside the data’s own range, and the axis labels, ticks and margins are the ones measured for the domains as given.
Not available on a log or time axis, where a “data unit” is not
a constant length: raises at render() time rather than
claiming a guarantee it cannot keep.
Args:
- self (
Self)
Returns:
Self: Self, for further chaining – render()/render_svg()
raise later on a log or time axis, or if the mark does not
support this.
scale_color_domain
fn def scale_color_domain(var self, min: Float64, max: Float64) -> SelfPin the continuous color domain to the given minimum and maximum, replacing the [min, max] this mark would otherwise take from its own colored values. scale_x_domain()’s color counterpart, and the thing that makes two color-encoded charts comparable.
Without it every continuous-color mark derives its own limits, so
two panels of the same quantity are drawn against two different
scales and look identical while meaning different things – the
reader has no way to see the difference, because the only place
it shows is in two legends whose numbers nobody cross-checks.
shared_color_domain() computes one domain across several
charts’ data to pass here; it is the counterpart to
shared_bin_edges().
Applies to every mark that colors by a continuous value:
Mark.HEATMAP, CALENDAR_HEATMAP, CORRPLOT, IMSHOW,
PCOLORMESH, HIST2D, HEXBIN, CONTOUR, CONTOURF,
TRICONTOUR, TRICONTOURF, TRIPCOLOR, QUIVER,
STREAMPLOT, and Plot.encode(color=...)’s continuous channel
on Mark.POINT/SINGLE_AXIS/EFFECT_SCATTER. Anything else
raises rather than accepting a setting it would ignore.
Mark.BOXENPLOT is not on the list even though it builds a
ColorScale: its ramp runs over the depth of the letter-value
nest, not over a data value, so an explicit data domain has
nothing to say about it.
Values outside the domain are not dropped; they clamp to the
ramp’s end color, because GradientStops.color_at() clamps t
outside [0, 1]. A separate under/over color would say more,
and is left for its own change (see the module note on
_color_scale_for).
The color legend follows automatically: every mark hands the
legend the same ColorScale it colored with, so the labels read
the overridden domain, not the data’s.
Args:
- self (
Self) - min (
Float64): The value the ramp’s low end means. - max (
Float64): The value the ramp’s high end means; must be> min.
Returns:
Self: Self, for further chaining – the render raises later if
min >= max or the mark has no continuous color channel.
scale_color_thresholds
fn def scale_color_thresholds(var self, boundaries: List[Float64]) -> SelfColor in discrete bands instead of a continuous ramp (#370).
n boundaries make n - 1 bands, and every value in a band
gets one flat color. That is what a reader needs when the
question is “which category is this” rather than “how much”:
soil pH bands, risk tiers, a legend with named ranges.
Intervals are lower-inclusive, [b[i], b[i+1]), with the
last closed at the top so the domain maximum has somewhere to
go. A value exactly on an interior boundary belongs to the band
above it. That is the one place this is easy to get wrong, so it
is stated here and
tested.
Values below the first boundary take the lowest band and values above the last take the highest, rather than raising. Clipping rather than rejecting keeps a shared threshold list usable across facets whose data ranges differ.
Boundaries must be strictly increasing, checked at render time along with the rest of the color domain.
Not combinable with scale_color_log() or
scale_color_center(): thresholds already say where every band
starts, so there is nothing left for either to place.
Args:
- self (
Self) - boundaries (
List[Float64]): The band edges, at least two, strictly increasing.
Returns:
Self: Self, for further chaining.
Raises:
scale_color_under
fn def scale_color_under(var self, color: Color) -> SelfColor values below the color domain with color instead of the ramp’s low end (#370).
Without it an out-of-range value clamps: a reading of -40 on a domain starting at 0 is painted the same as a reading of 0, and the chart says the two are alike. A distinct color says “this is off the scale”, which is a different statement and usually the one that matters – a sensor out of range, a region with no data of its own, a value the domain was deliberately narrowed to exclude.
Applies to every mark scale_color_domain() applies to, and to
every form of the ramp: continuous, logarithmic and banded. With
scale_color_thresholds() the band edges are the range, so
“below” means below the first boundary.
The color legend shows it, as a block at the low end of the bar inside the bar’s own footprint, so the legend costs exactly the room it did before and its end labels stay attached to the ends of the ramp, where those numbers are true.
Args:
- self (
Self) - color (
Color): The color for a value below the domain.
Returns:
Self: Self, for further chaining.
scale_color_over
fn def scale_color_over(var self, color: Color) -> SelfColor values above the color domain with color instead of the ramp’s high end – scale_color_under()’s mirror, and see that method’s docstring for the shared rules (#370).
Values exactly at the domain maximum belong to the ramp, not to the over color: the top end is part of the range, which is the rule the last threshold band already follows.
Args:
- self (
Self) - color (
Color): The color for a value above the domain.
Returns:
Self: Self, for further chaining.
scale_color_log
fn def scale_color_log(var self) -> SelfNormalize color by log10 instead of linearly (#370).
A linear ramp cannot resolve values spread over several orders of magnitude: on a 1-to-10,000 domain everything below 1,000 lands in the first tenth of the ramp and reads as one color. With this, equal ratios get equal color distance, so 1 to 10 spans as much of the ramp as 1,000 to 10,000.
The domain must be strictly positive, whether it came from the
data or from scale_color_domain(). That is checked at render
time, because until then the mark’s own limits are not known.
Not combinable with scale_color_center(): centering places the
neutral color by linear distance from each end, which a log
domain does not preserve.
Args:
- self (
Self)
Returns:
Self: Self, for further chaining.
Raises:
scale_color_center
fn def scale_color_center(var self, center: Float64) -> SelfPin the middle of the color ramp to center, so a diverging ramp’s neutral color lands on a value that means something – zero, a baseline, a target – instead of on the numeric midpoint of whatever the data happened to span.
A diverging ramp’s whole claim is that its middle is neutral and its two ends are opposite. Placed at the data’s midpoint that claim is simply false: over values from -2 to +10 the neutral color sits at +4, so half the positive range is painted in the color that is supposed to mean “negative”. Centering fixes the mapping rather than the data, and the two arms are then free to be different sizes – which is the honest picture when the data is not symmetric.
Separate from scale_color_domain() on purpose. Centering is
about where the ramp’s middle goes, not about what its ends
mean, and the two are wanted independently: a center on its own
re-places the middle inside the data’s own limits, which is the
common case, while a domain on its own leaves the ramp
symmetric. Folding both into one call would have forced every
caller who wants a centered ramp to also state limits they had
no opinion about.
center must lie strictly inside the resolved color domain. It
is not quietly widened to fit: widening would move the ramp’s
ends, so a chart asking only “center this at zero” would get
different end colors than the one beside it, which is the silent
disagreement the whole feature exists to remove. The render
raises and names the domain instead, so the fix is an explicit
scale_color_domain().
This is reached by moving the ramp’s stops instead of bending
the value projection; see
ColorScale.from_theme_centered() for why that route is the one
that keeps the legend honest.
Defined for any ramp, not only a three-stop diverging one – it
means “the color at offset 0.5 lands on center” whatever the
stops are. On a sequential ramp like colormaps.viridis() that
is legal but rarely useful.
Args:
- self (
Self) - center (
Float64): The value the ramp’s middle color sits on. Must be strictly between the color domain’s min and max.
Returns:
Self: Self, for further chaining – the render raises later if
center is not strictly inside the domain, or the mark has
no continuous color channel.
secondary_axis
fn def secondary_axis(var self) -> SelfDraw this layer’s y values against a second, independent y-domain on the plot’s right edge instead of render_layers()’s shared left-axis domain (ECharts’ yAxisIndex: 1, as a boolean since only two y-axes are ever drawn). For a combo chart whose series have different units; see _render_layers_generic.
render_layers()/render_layers_svg() only; render()/
render_svg() raise if a plot with this set reaches them. At least
one layer must stay on the primary axis. The secondary axis gets an
axis line, ticks, and tick labels on the right edge but no
gridlines. This layer’s Plot.labels() y_title captions the
secondary axis (see _secondary_axis_y_title).
See the Cookbook’s own “Dual Y-Axis” recipe (docs/src/ cookbook_recipes/dual_axis.mojo) for a full worked example.
Args:
- self (
Self)
Returns:
Self: Self, for further chaining.
encode
fn def encode(var self, x: List[Float64], y: List[Float64], color: List[Float64] = List(), color_categories: List[String] = List(), size: List[Float64] = List(), y_err: List[Float64] = List(), y_err_lower: List[Float64] = List(), y_err_upper: List[Float64] = List(), color_map: Dict[String, Color] = Dict(), shape_map: Dict[String, PointShape] = Dict(), labels: List[String] = List(), x_err: List[Float64] = List(), x_err_lower: List[Float64] = List(), x_err_upper: List[Float64] = List()) -> Chart[Point]encode() with the default mark: a point chart. The same as Plot().mark_point().encode(...).
Args:
- self (
Self) - x (
List[Float64]) - y (
List[Float64]) - color (
List[Float64]) - color_categories (
List[String]) - size (
List[Float64]) - y_err (
List[Float64]) - y_err_lower (
List[Float64]) - y_err_upper (
List[Float64]) - color_map (
Dict[String, Color]) - shape_map (
Dict[String, PointShape]) - labels (
List[String]) - x_err (
List[Float64]) - x_err_lower (
List[Float64]) - x_err_upper (
List[Float64])
Returns:
Chart[Point]
Raises:
mark_point
fn def mark_point(var self, jitter_x: Float64 = 0, jitter_y: Float64 = 0) -> Chart[Point]A scatter plot: one point per (x, y) pair.
Each SVG point’s hover title, when tooltips are on (see
tooltips()), is its encoded label or its coordinates.
jitter_x/jitter_y offset each point by up to that many pixels,
to separate points that would otherwise overplot. Both default
to 0.0, which leaves every point exactly where it was.
The offset is deterministic, not random: point i moves by
(2 * frac(i * phi) - 1) * jitter, where phi is the golden
ratio’s conjugate. That spreads successive points evenly rather
than clumping the way sampling does, is hand-derivable in a test,
and gives the same picture on every render, which a seeded
generator would only give for a fixed seed. See
_jitter_offset().
Jitter is a visual device. It moves points away from their data positions on purpose, so a reader cannot recover exact values from a jittered chart, and it should not be used where they need to.
Args:
- self (
Self) - jitter_x (
Float64): Half-width in pixels of the x offset; 0.0 is off. - jitter_y (
Float64): The same for y.
Returns:
Chart[Point]: Self, for further chaining.
Raises:
Error: Either jitter is negative.
mark_line
fn def mark_line(var self, style: LineStyle = LineStyle.SOLID, step: StepStyle = StepStyle.NONE) -> Chart[Line]A line plot: (x, y) pairs connected in data order, not sorted by x. Sort the data first if that isn’t the order to draw.
step holds each value flat before jumping to the next. It is
mutually exclusive with Theme.line_smoothing.
Args:
- self (
Self) - style (
LineStyle): How the stroke is broken up –SOLID(the default),DASHED,DOTTEDorDASH_DOT. Useful for telling series apart without relying on color, which matters in print and for readers who cannot separate the palette. - step (
StepStyle): Where the riser between two samples sits –NONE(the default: a straight segment, no stepping),PRE(at the earlier x),MID(halfway) orPOST(at the later x); seeStepStylefor which one claims what.
Returns:
Chart[Line]: Self, for further chaining.
mark_bar
fn def mark_bar(var self, horizontal: Bool = False) -> Chart[Bar]A bar chart: one bar per category, encoded via encode_categorical().
`horizontal` (default `False`) draws categories top-to-bottom along
the y-axis with each bar extending from a zero baseline to the right
, via _draw_horizontal_categorical_axis_frame (gantt.mojo);
see _render_horizontal_bar (bar.mojo).
Args:
- self (
Self) - horizontal (
Bool)
Returns:
Chart[Bar]
mark_area
fn def mark_area(var self, step: StepStyle = StepStyle.NONE) -> Chart[Area]An area chart: mark_line()’s continuous (x, y) pairs, filled from each point down to a zero baseline. Encoded via encode().
step applies the same interpolation as mark_line() to the
fill’s top edge. The closing segments to and along the baseline
remain straight. Stepping is mutually exclusive with
Theme.line_smoothing.
Args:
- self (
Self) - step (
StepStyle): Where the riser between two samples sits –NONE(the default: a straight top edge, no stepping),PRE(at the earlier x),MID(halfway) orPOST(at the later x); seeStepStylefor which one claims what. Mutually exclusive withTheme.line_smoothing, which raises.
Returns:
Chart[Area]: Self, for further chaining.
mark_histogram
fn def mark_histogram(var self, horizontal: Bool = False) -> Chart[Histogram]A histogram drawn as one rectangle per bin at numeric x positions, with a separator between adjacent bins (Theme.histogram_edge_color); horizontal puts the bins up the y-axis and the values running right. Encoded from raw observations via encode_histogram() – the same binning histogram() does – or from bins already computed via encode_histogram_bins() (#698); see _draw_histogram_layer (histogram.mojo) for the drawing and histogram() for the one-call form. Follows Mark.AREA’s rules everywhere else: a zero-baselined y-domain, render_layers() and render_facets(shared_y_scale=True) support, no log y-axis. A horizontal histogram keeps the bins’ range on y (pin it with scale_y_domain()) and zero-baselines x instead; render_layers() refuses it.
Args:
- self (
Self) - horizontal (
Bool): Bins up the y-axis, values running right.
Returns:
Chart[Histogram]: Self, for further chaining.
mark_arc
fn def mark_arc(var self, inner_radius_fraction: Float64 = 0) -> Chart[Arc]A pie chart: one wedge per category, its angular span proportional to its value, encoded via encode_categorical(). Every value must be non-negative and at least one positive, checked at render() time. inner_radius_fraction > 0.0 (in [0.0, 1.0)) makes a donut.
Args:
- self (
Self) - inner_radius_fraction (
Float64)
Returns:
Chart[Arc]
mark_nightingale
fn def mark_nightingale(var self, area: Bool = False) -> Chart[Nightingale]A rose/coxcomb chart: one wedge per category, all wedges the same angular width, with magnitude encoded by radius (unlike mark_arc()). Encoded via encode_categorical(). area=True scales each wedge’s radius by sqrt(value / max) (ECharts’ rose_type="area") instead of the default linear value / max (rose_type="radius"); see _render_nightingale. Every value must be non-negative and at least one positive, checked at render() time.
Args:
- self (
Self) - area (
Bool):False(the default) scales each wedge’s radius byvalue / max;Truescales its area instead (sqrt(value / max), ECharts’rose_type="area").
Returns:
Chart[Nightingale]: Self, for further chaining.
mark_polar_bar
fn def mark_polar_bar(var self, padding: Float64 = 0.20000000000000001) -> Chart[PolarBar]A circular column chart: bars radiate outward from the center, one equal-width angular slot per category with a gap of padding (a fraction of the slot) between bars. Encoded via encode_categorical(). Bar length scales linearly by value / max(values); there is no area mode. Every value must be non-negative and at least one positive, checked at render() time.
Args:
- self (
Self) - padding (
Float64)
Returns:
Chart[PolarBar]
mark_radialbar
fn def mark_radialbar(var self, ring_gap_fraction: Float64 = 0.25) -> Chart[Radialbar]A radial (multi-ring) progress chart: one concentric ring per category, swept clockwise from 12 o’clock over a track to value / max(values) of the way around, with the first category outermost. ring_gap_fraction is the gap between rings as a fraction of each ring’s slot. Encoded via encode_categorical(). Every value must be non-negative and at least one positive, checked at render() time.
Args:
- self (
Self) - ring_gap_fraction (
Float64)
Returns:
Chart[Radialbar]
mark_polar
fn def mark_polar(var self, grid_rings: Int = Int(4), grid_spokes: Int = Int(12)) -> Chart[Polar]A polar-coordinate line plot: (angle, radius) pairs connected in row order over a polar grid of grid_rings circles and grid_spokes radial lines. Encoded via encode_polar() (one unnamed series) or encode_polar_series() (several named series sharing one angle domain). See _render_polar.
Args:
- self (
Self) - grid_rings (
Int) - grid_spokes (
Int)
Returns:
Chart[Polar]
mark_radar
fn def mark_radar(var self, grid_rings: Int = Int(4)) -> Chart[Radar]A radar/spider chart: one spoke per named indicator, one polygon per named series, with grid_rings web rings. Encoded via encode_radar().
Args:
- self (
Self) - grid_rings (
Int)
Returns:
Chart[Radar]
mark_gauge
fn def mark_gauge(var self, band_inner_fraction: Float64 = 0.69999999999999996, needle_fraction: Float64 = 0.90000000000000002, start_angle: Float64 = 2.3561944901923448, sweep_angle: Float64 = 4.7123889803846897) -> Chart[Gauge]A gauge chart: a single value shown as a needle over a color-banded dial. Encoded via encode_gauge(), which also takes the bands’ breakpoints/band_colors. band_inner_fraction/needle_fraction are fractions of the dial radius; start_angle/sweep_angle are radians (the defaults give a 270-degree dial opening downward).
Args:
- self (
Self) - band_inner_fraction (
Float64) - needle_fraction (
Float64) - start_angle (
Float64) - sweep_angle (
Float64)
Returns:
Chart[Gauge]
mark_parallel
fn def mark_parallel(var self) -> Chart[Parallel]A parallel-coordinates chart: one row drawn as a polyline across evenly spaced, independently scaled vertical axes, one per dimension. Encoded via encode_parallel().
Args:
- self (
Self)
Returns:
Chart[Parallel]
mark_pointplot
fn def mark_pointplot(var self, horizontal: Bool = False) -> Chart[Pointplot]Use Mark.POINTPLOT: one point per category at its value, with encode_categorical()’s y_err_lower/y_err_upper as a whisker and a line joining the points – the glyph pointplot() draws for an estimate per category. The value axis follows the data rather than starting at zero; see _pointplot_value_extent.
Args:
- self (
Self) - horizontal (
Bool): Run the categories down the page and the values rightward, for long category names.
Returns:
Chart[Pointplot]: Self, for further chaining.
mark_lollipop
fn def mark_lollipop(var self, horizontal: Bool = False) -> Chart[Lollipop]A lollipop chart: one stem-plus-point per category, encoded via encode_categorical() (the same data as mark_bar()). horizontal (default False) draws categories top-to-bottom with each stem extending to the right; see _render_horizontal_lollipop (lollipop.mojo).
Args:
- self (
Self) - horizontal (
Bool)
Returns:
Chart[Lollipop]
mark_waterfall
fn def mark_waterfall(var self, delta_width_fraction: Float64 = 0.59999999999999998, horizontal: Bool = False) -> Chart[Waterfall]A waterfall chart: one floating bar per category, each running from the previous running total to the next. Encoded via encode_waterfall() (a category plus a signed delta). delta_width_fraction is a delta bar’s width as a fraction of the band, applied only when is_total rows are in use.
Args:
- self (
Self) - delta_width_fraction (
Float64) - horizontal (
Bool)
Returns:
Chart[Waterfall]
mark_boxenplot
fn def mark_boxenplot(var self, horizontal: Bool = False) -> Chart[Boxenplot]Use Mark.BOXENPLOT: a letter-value plot – Mark.BOX with nested boxes at successively finer quantiles instead of one box and two whiskers – over encode_boxenplot(). horizontal draws categories top-to-bottom; see _render_boxenplot (boxen.mojo).
Args:
- self (
Self) - horizontal (
Bool): Categories on the y-axis, values on the x-axis.
Returns:
Chart[Boxenplot]: Self, for further chaining.
mark_box
fn def mark_box(var self, horizontal: Bool = False) -> Chart[Box]A box plot: one box-and-whiskers per category summarizing a distribution of raw values. Encoded via encode_boxplot(), which computes quartiles/whiskers/outliers immediately. horizontal (default False) draws categories top-to-bottom with each box left-to-right; see _render_horizontal_box (box.mojo).
Args:
- self (
Self) - horizontal (
Bool)
Returns:
Chart[Box]
mark_candlestick
fn def mark_candlestick(var self) -> Chart[Candlestick]A candlestick chart: one open/high/low/close bar per category. Encoded via encode_candlestick().
Args:
- self (
Self)
Returns:
Chart[Candlestick]
mark_bullet
fn def mark_bullet(var self, measure_width_fraction: Float64 = 0.34999999999999998, horizontal: Bool = False) -> Chart[Bullet]A bullet chart (Stephen Few’s design): a measure bar, a target tick, and qualitative-range bands per category. Encoded via encode_bullet(). measure_width_fraction is the measure bar’s width as a fraction of the band.
Args:
- self (
Self) - measure_width_fraction (
Float64) - horizontal (
Bool)
Returns:
Chart[Bullet]
mark_gantt
fn def mark_gantt(var self) -> Chart[Gantt]A gantt chart: one horizontal bar per category from a start value to an end value, with categories along the y-axis. Encoded via encode_gantt(). See mark_span_chart() for the same data drawn vertically.
Args:
- self (
Self)
Returns:
Chart[Gantt]
mark_span_chart
fn def mark_span_chart(var self) -> Chart[SpanChart]A span chart: mark_gantt()’s mirror image, one floating vertical bar per category from a low value to a high value on the normal categorical x-axis. Encoded via encode_gantt().
Args:
- self (
Self)
Returns:
Chart[SpanChart]
mark_calendar_heatmap
fn def mark_calendar_heatmap(var self) -> Chart[CalendarHeatmap]A calendar heatmap: daily values in a GitHub-contributions-style grid, colored through a continuous gradient. Encoded via encode_calendar() ("YYYY-MM-DD" dates).
Args:
- self (
Self)
Returns:
Chart[CalendarHeatmap]
mark_corrplot
fn def mark_corrplot(var self, layout: String = "full", diag: Bool = True, labels: Bool = True, bubble_fraction: Float64 = 0.41999999999999998) -> Chart[Corrplot]A correlation plot: one bubble per cell of a square correlation matrix, sized by strength and colored by sign. Encoded via encode_corrplot(). layout and diag control which cells draw; see _render_corrplot.
Args:
- self (
Self) - layout (
String): Which triangle to draw –"full"(the default),"lower", or"upper". - diag (
Bool): Whether to draw the diagonal cells; defaults toTrue. - labels (
Bool): Whether to draw variable names along the axes; defaults toTrue. - bubble_fraction (
Float64): Each bubble’s maximum radius as a fraction of the cell’s smaller dimension, atabs(r) == 1; defaults to0.42.
Returns:
Chart[Corrplot]: Self, for further chaining.
mark_punchcard
fn def mark_punchcard(var self, scale: Float64 = 10) -> Chart[Punchcard]A punchcard: a scatter plot on a categorical grid where bubble size encodes a third variable. Encoded via encode_punchcard(). scale (default 10.0, matching ECharts.jl) is the pixel-space divisor each bubble’s radius comes from (size / scale); see _render_punchcard.
Args:
- self (
Self) - scale (
Float64): Divides each bubble’s raw size before drawing – raise it to shrink bubbles that would otherwise overlap.
Returns:
Chart[Punchcard]: Self, for further chaining.
mark_barbs
fn def mark_barbs(var self, length: Float64 = 28, flip: Bool = False) -> Chart[Barbs]Wind barbs: one station-model glyph per point, its staff pointing upwind and its flags/barbs summing to the speed. Encoded via encode_barbs(); see _render_barbs for the glyph and barbs() for the one-call form.
Args:
- self (
Self) - length (
Float64): Staff length in pixels beforeTheme.scale, which every feature on the glyph is sized as a fraction of. - flip (
Bool): Mirror every feature across its staff – the southern- hemisphere convention.
Returns:
Chart[Barbs]: Self, for further chaining.
mark_quiver
fn def mark_quiver(var self, scale: Float64 = 0, color_by_magnitude: Bool = False) -> Chart[Quiver]Select Mark.QUIVER: a vector field as arrows, one per point along (u, v) with length proportional to magnitude. Encoded via encode_quiver(); see _render_quiver (quiver.mojo) for the glyph and quiver() for the one-call form.
Args:
- self (
Self) - scale (
Float64): Pixels per unit of magnitude beforeTheme.scale, or 0 for the automatic rule (seequiver()). - color_by_magnitude (
Bool): Color each arrow byhypot(u, v)through the theme’s ramp, with a color legend.
Returns:
Chart[Quiver]: Self, for further chaining.
mark_contour
fn def mark_contour(var self, levels: Int = Int(8)) -> Chart[Contour]Isolines over a regular grid: marching squares per level, each line stroked in its level’s color. Encoded via encode_contour(); see _render_contour for the tracing and contour() for the one-call form.
Args:
- self (
Self) - levels (
Int): How many levels to place whenencode_contour()is not given an explicit list – spaced evenly strictly inside the grid’s own range. Must be positive.
Returns:
Chart[Contour]: Self, for further chaining.
mark_contourf
fn def mark_contourf(var self, levels: Int = Int(8)) -> Chart[Contourf]Filled bands between consecutive levels: mark_contour()’s companion, shading each level’s region instead of outlining it. Encoded via encode_contour(); see _render_contourf for the painting order and contourf() for the one-call form.
Args:
- self (
Self) - levels (
Int): How many band boundaries to place whenencode_contour()is not given an explicit list – spaced evenly strictly inside the grid’s own range. Must be positive.
Returns:
Chart[Contourf]: Self, for further chaining.
mark_imshow
fn def mark_imshow(var self) -> Chart[Imshow]A 2D array drawn as an image: one flat-colored cell per element, on continuous axes in row/column index units. Encoded via encode_imshow(); see _render_image for the drawing and imshow() (image.mojo) for the one-call form.
Row 0 is at the top and the y-axis counts downward, which is
the opposite of mark_contour() over the same grid – see
imshow()’s docstring for why an image and a sampled surface
differ here.
Args:
- self (
Self)
Returns:
Chart[Imshow]: Self, for further chaining.
mark_pcolormesh
fn def mark_pcolormesh(var self) -> Chart[Pcolormesh]mark_imshow() over cell boundaries the caller supplies, for a grid whose rows and columns are not evenly spaced. Encoded via encode_pcolormesh(); see _render_image for the drawing and pcolormesh() (image.mojo) for the one-call form.
Row 0 is at the bottom here, unlike mark_imshow(): the edges
are positions on a real axis rather than scanlines.
Args:
- self (
Self)
Returns:
Chart[Pcolormesh]: Self, for further chaining.
mark_hist2d
fn def mark_hist2d(var self) -> Chart[Hist2d]Select Mark.HIST2D: (x, y) points binned into a grid of counts and drawn as colored cells, empty cells left undrawn. Pair with encode_hist2d(); see _render_image for the drawing and hist2d() (hist2d.mojo) for the one-call form.
Args:
- self (
Self)
Returns:
Chart[Hist2d]: Self, for further chaining.
mark_hexbin
fn def mark_hexbin(var self) -> Chart[Hexbin]Select Mark.HEXBIN: (x, y) points counted into a hexagonal lattice and drawn as colored hexagons, empty cells left undrawn. Pair with encode_hexbin(); see _render_hexbin (hexbin.mojo) for the drawing and hexbin() for the one-call form.
Args:
- self (
Self)
Returns:
Chart[Hexbin]: Self, for further chaining.
mark_streamplot
fn def mark_streamplot(var self, density: Float64 = 1, arrows: Bool = True, color_by_magnitude: Bool = False) -> Chart[Streamplot]Select Mark.STREAMPLOT: a vector field on a grid integrated into streamlines. Pair with encode_streamplot(); see _render_streamplot (streamplot.mojo) for the integrator and streamplot() for the one-call form.
Args:
- self (
Self) - density (
Float64): Line spacing: the occupancy cells per axis over 30, so larger means more lines. - arrows (
Bool): Draw an arrowhead at the middle of each line. - color_by_magnitude (
Bool): Color each step by the localhypot(u, v)through the theme’s ramp, with a legend.
Returns:
Chart[Streamplot]: Self, for further chaining.
mark_tricontour
fn def mark_tricontour(var self, levels: Int = Int(8)) -> Chart[Tricontour]Isolines over scattered samples: the points are Delaunay- triangulated and each level traced over the triangles. Encoded via encode_tricontour(); see _render_tricontour for the tracing and tricontour() for the one-call form.
Args:
- self (
Self) - levels (
Int): How many levels to place whenencode_tricontour()is not given an explicit list – spaced evenly strictly inside the samples’ own range. Must be positive.
Returns:
Chart[Tricontour]: Self, for further chaining.
mark_tricontourf
fn def mark_tricontourf(var self, levels: Int = Int(8)) -> Chart[Tricontourf]Filled bands over scattered samples: mark_tricontour()’s regions rather than its lines, over the same Delaunay triangulation and the same encode_tricontour() data. See _render_tricontourf for how they are painted and tricontourf() for the one-call form.
Args:
- self (
Self) - levels (
Int): How many levels to place whenencode_tricontour()is not given an explicit list – spaced evenly strictly inside the samples’ own range. Must be positive.
Returns:
Chart[Tricontourf]: Self, for further chaining.
mark_dendrogram
fn def mark_dendrogram(var self, horizontal: Bool = False) -> Chart[DendrogramMark]Select Mark.DENDROGRAM: the merge tree agglomerative clustering produces, drawn as brackets. Encoded via encode_dendrogram(); see dendrogram() for the one-call form that clusters the rows for you (#355).
Args:
- self (
Self) - horizontal (
Bool): Run the leaves down the y-axis with the brackets reaching right, for a tree that sits beside a matrix’s rows rather than above its columns.
Returns:
Chart[DendrogramMark]: Self, for further chaining.
mark_triplot
fn def mark_triplot(var self, show_points: Bool = True) -> Chart[Triplot]The Delaunay triangulation of scattered points drawn as itself: every edge of the mesh, stroked once. Encoded via encode_triplot(); see _render_triplot (triplot.mojo) for the drawing and triplot() for the one-call form.
Args:
- self (
Self) - show_points (
Bool): Draw a dot at every sample on top of the mesh. Defaults toTrue;_render_triplotsays why.
Returns:
Chart[Triplot]: Self, for further chaining.
mark_tripcolor
fn def mark_tripcolor(var self) -> Chart[Tripcolor]Each triangle of the Delaunay mesh filled from the values at its three vertices – mark_triplot()’s mesh painted rather than stroked, over the same encode_triplot() data, which must then carry z. See _render_tripcolor (triplot.mojo) for the flat shading and the seam handling, and tripcolor() for the one-call form.
Args:
- self (
Self)
Returns:
Chart[Tripcolor]: Self, for further chaining.
mark_marimekko
fn def mark_marimekko(var self) -> Chart[Marimekko]A Marimekko/mosaic chart: column widths proportional to each category’s share of the grand total, stacked segment heights showing each column’s subcategory composition. Encoded via encode_marimekko().
Args:
- self (
Self)
Returns:
Chart[Marimekko]
mark_sunburst
fn def mark_sunburst(var self) -> Chart[Sunburst]A sunburst chart: a hierarchy as concentric rings, one ring per depth level, each node’s angular span proportional to its share of its parent’s total. Encoded via encode_hierarchy().
Args:
- self (
Self)
Returns:
Chart[Sunburst]
mark_tree
fn def mark_tree(var self) -> Chart[Tree]A tree diagram: a hierarchy as a top-to-bottom node-link diagram. Encoded via encode_hierarchy().
Args:
- self (
Self)
Returns:
Chart[Tree]
mark_treemap
fn def mark_treemap(var self) -> Chart[Treemap]A treemap: a hierarchy as nested, area-proportional rectangles via slice-and-dice. Encoded via encode_hierarchy().
Args:
- self (
Self)
Returns:
Chart[Treemap]
mark_grouped_bar
fn def mark_grouped_bar(var self, horizontal: Bool = False) -> Chart[GroupedBar]A grouped bar chart: several bars side by side per category, one per series. Encoded via encode_grouped_bar(). horizontal (default False) draws categories top-to-bottom with each row subdivided into equal-height sub-bars; see _render_horizontal_grouped_bar (grouped_bar.mojo).
Args:
- self (
Self) - horizontal (
Bool)
Returns:
Chart[GroupedBar]
mark_stacked_bar
fn def mark_stacked_bar(var self, percent: Bool = False, horizontal: Bool = False) -> Chart[StackedBar]A stacked bar chart: one bar per category, each series’ value stacked as a segment on the previous running total. Encoded via encode_grouped_bar(), the same data as mark_grouped_bar().
percent=True normalizes each category’s segments to sum to 100%,
fixing the y-axis from 0 to 100.
Every value must then be non-negative, checked at render() time; an
all-zero category draws as an empty column.
horizontal (default False) draws categories top-to-bottom with
each category’s segments stacked left-to-right; see
_render_horizontal_stacked_bar (stacked_bar.mojo).
Args:
- self (
Self) - percent (
Bool):False(the default) stacks raw values, an unchanged real-valued y-axis.Truenormalizes each category to 100% and fixes the y-axis from 0 to 100. - horizontal (
Bool): Draw categories running top-to-bottom with each category’s segments stacked left-to-right instead of the default vertical layout.
Returns:
Chart[StackedBar]: Self, for further chaining.
mark_population_pyramid
fn def mark_population_pyramid(var self) -> Chart[PopulationPyramid]A population pyramid: two magnitude bars per category growing outward left/right from a shared, centered zero baseline, on Mark.GANTT’s horizontal categorical frame. Encoded via encode_population_pyramid().
Args:
- self (
Self)
Returns:
Chart[PopulationPyramid]
mark_heatmap
fn def mark_heatmap(var self) -> Chart[Heatmap]A heatmap: one colored grid cell per (x, y) category pair, on two categorical axes. Encoded via encode_heatmap().
Args:
- self (
Self)
Returns:
Chart[Heatmap]
mark_chord
fn def mark_chord(var self, ring_fraction: Float64 = 0.080000000000000002) -> Chart[Chord]A chord diagram: ring sectors for every distinct node across an edge list’s from/to columns, connected by ribbons sized by each flow’s value. Encoded via encode_chord(). ring_fraction is the rim’s thickness as a fraction of the radius. No axis frame.
Args:
- self (
Self) - ring_fraction (
Float64)
Returns:
Chart[Chord]
mark_arc_diagram
fn def mark_arc_diagram(var self) -> Chart[ArcDiagram]An arc diagram: mark_chord()’s edge list drawn as nodes on one line connected by semicircular arcs. Encoded via encode_chord().
Args:
- self (
Self)
Returns:
Chart[ArcDiagram]
mark_graph
fn def mark_graph(var self, layout: GraphLayout = GraphLayout.CIRCLE) -> Chart[Graph]A network graph: mark_chord()’s edge list drawn as nodes connected by straight lines, placed around a circle or by a force-directed layout (see GraphLayout). Encoded via encode_chord().
Args:
- self (
Self) - layout (
GraphLayout):GraphLayout.CIRCLE(the default) orGraphLayout.FORCE(#157).
Returns:
Chart[Graph]: Self, for further chaining.
mark_sankey
fn def mark_sankey(var self, node_width: Float64 = 12) -> Chart[Sankey]A Sankey diagram: mark_chord()’s edge list laid out left-to-right by column as proportionally sized flow ribbons between node bars node_width pixels wide (before Theme.scale). Encoded via encode_chord(); the edges must form a DAG.
Args:
- self (
Self) - node_width (
Float64)
Returns:
Chart[Sankey]
mark_single_axis
fn def mark_single_axis(var self) -> Chart[SingleAxis]A single-axis chart: every value plotted along one horizontal axis with no y-axis. Encoded via encode_single_axis(), with the same optional color/color_categories/size channels as Mark.POINT.
Args:
- self (
Self)
Returns:
Chart[SingleAxis]: Self, for further chaining.
mark_effect_scatter
fn def mark_effect_scatter(var self) -> Chart[EffectScatter]A scatter plot with a halo drawn under each point, the static equivalent of ECharts’ effect scatter (see _draw_point_layer’s draw_halo). Encoded like Mark.POINT, via encode().
Args:
- self (
Self)
Returns:
Chart[EffectScatter]
mark_funnel
fn def mark_funnel(var self) -> Chart[Funnel]A funnel chart: one tapering trapezoid per category, largest value first, with no axis frame. Encoded via encode_categorical().
Args:
- self (
Self)
Returns:
Chart[Funnel]
mark_bump
fn def mark_bump(var self) -> Chart[Bump]A bump chart: one line per series tracking its rank (1 = highest value) among every series at each category. Encoded via encode_grouped_bar().
Args:
- self (
Self)
Returns:
Chart[Bump]
mark_streamgraph
fn def mark_streamgraph(var self, baseline: StackBaseline = StackBaseline.WIGGLE, step: StepStyle = StepStyle.NONE) -> Chart[Streamgraph]A streamgraph: mark_stacked_bar()’s running-total stack drawn as flowing bands rather than rects. Encoded via encode_grouped_bar().
baseline chooses where each category’s stack starts.
WIGGLE (the default) centers it on zero, the streamgraph
proper. ZERO starts it at a flat zero, which is the ordinary
stacked area chart – stacked_area() is the name to reach for
there. See StackBaseline.
step is the same stairs interpolation mark_line() and
mark_area() takes, applied to every band’s top
and bottom edge: the composition holds flat and then
jumps, instead of sliding from one category to the next. It is
the shape for a stacked quantity that is constant between
readings – capacity by source, headcount by team, inventory by
warehouse.
Both edges of a band step, in the same style, or the stack
stops tiling: band j’s bottom edge is band j - 1’s top
edge, and two edges that disagree about where the riser goes
leave a wedge of background between the bands. See
_render_streamgraph for how the reversed bottom edge is kept
in step with the forward top one.
Args:
- self (
Self) - baseline (
StackBaseline): Where each category’s stack starts –WIGGLE(centered on zero) orZERO(a flat baseline). - step (
StepStyle): Where the riser between two categories sits –NONE(the default: straight segments),PRE(at the earlier category),MID(halfway) orPOST(at the later one). Mutually exclusive withTheme.line_smoothing, which raises.streamgraph()defaults that to0.6, so a stepped stream would raise on its own default;stacked_area()is the one-call function that exposes this.
Returns:
Chart[Streamgraph]: Self, for further chaining.
mark_beeswarm
fn def mark_beeswarm(var self, horizontal: Bool = False) -> Chart[Beeswarm]A beeswarm plot: one point per raw value, jittered sideways within its category’s band. Encoded via encode_distribution(). horizontal (default False) draws categories top-to-bottom with each swarm jittered vertically; see _render_horizontal_beeswarm (beeswarm.mojo).
Args:
- self (
Self) - horizontal (
Bool)
Returns:
Chart[Beeswarm]
mark_violin
fn def mark_violin(var self, bandwidth: Float64 = 0, scale_by_count: Bool = False, horizontal: Bool = False, width_fraction: Float64 = 0.40000000000000002) -> Chart[Violin]A violin plot: a symmetric kernel-density-estimate silhouette per category. Encoded via encode_distribution().
bandwidth (when positive; checked at render() time) replaces every
category’s Silverman’s-rule bandwidth (_kde_bandwidth(),
violin.mojo) with one shared value, so categories’ shapes can be
compared without Silverman’s rule reacting to each sample size.
scale_by_count=True scales each category’s maximum width by
sqrt(n_i / max(n)) instead of giving every category the same
maximum width.
Args:
- self (
Self) - bandwidth (
Float64): Overrides every category’s Silverman’s-rule kernel-density bandwidth with one shared value; must be positive if given. Left at its default0.0, each category gets its own Silverman’s-rule bandwidth. - scale_by_count (
Bool):False(the default,scale = "width") gives every category’s peak the same maximum width;True(scale = "area") additionally scales a category’s maximum width bysqrt(n_i / max(n)). - horizontal (
Bool):False(the default) draws each silhouette bulging left-right around a vertical column, one column per category left-to-right.True– exactlymark_bar(horizontal=True)’s own flip – draws each silhouette bulging up-down around a horizontal row, one row per category top-to-bottom, reusing_draw_horizontal_categorical_axis_frame(gantt.mojo) – see_render_horizontal_violin’s own docstring (violin.mojo). - width_fraction (
Float64): Each violin’s maximum half-width as a fraction of its category’s band width; defaults to0.4.
Returns:
Chart[Violin]: Self, for further chaining.
mark_kde
fn def mark_kde(var self, bandwidth: Float64 = 0, fill: Bool = False, rug: Bool = False) -> Chart[Kde]A kernel-density curve over raw observations: mark_violin()’s estimate drawn on a continuous frame – value across, density up – rather than mirrored inside a category band. Encoded via encode_kde(); see kdeplot() for the one-call form.
Comparing several distributions on one frame is
render_layers() over a Mark.KDE layer each: they
share one density axis, so the peak heights are comparable.
rug=True adds this layer’s own observations underneath, and a
separate mark_rug() layer draws the same ticks.
Args:
- self (
Self) - bandwidth (
Float64): The kernel bandwidth. Not positive (the default) uses Silverman’s rule. This is the parameter that changes the conclusion – the same sample can show one mode or three depending on it – so it is worth setting deliberately rather than trusting the default. - fill (
Bool): Shade the curve down to zero as well as stroking it. - rug (
Bool): Draw each observation as a short tick along the baseline. A density curve is smooth everywhere, including where nothing was observed, so the rug is what shows where the sample actually is.
Returns:
Chart[Kde]: Self, for further chaining.
mark_rug
fn def mark_rug(var self) -> Chart[Rug]One short tick per observation along the x axis. Encoded via encode_kde(); see rugplot() for the one-call form.
The same ticks mark_kde(rug=True) draws under its curve, as a
chart of their own – or as a render_layers() layer under a
mark_kde() one, which draws the same thing.
Args:
- self (
Self)
Returns:
Chart[Rug]: Self, for further chaining.
mark_ecdf
fn def mark_ecdf(var self, complementary: Bool = False) -> Chart[Ecdf]An empirical cumulative distribution: the fraction of observations at or below each x, as a staircase rising from 0 to 1. Encoded via encode_ecdf(); see ecdf() for the one-call form.
The one distribution chart with no parameter that can change the
conclusion – no bin width (histogram()), no bandwidth
(mark_kde()). Ties share a single step of k/n, and the curve
is drawn over the data’s own range rather than out to the axis
edges; both are _ecdf_points()’s doing (ecdf.mojo), which
documents why.
Comparing two distributions on one frame is the main reason to
draw an ECDF, and render_layers() takes this mark: two ECDF
layers share one frame with the proportion axis pinned to [0, 1].
Args:
- self (
Self) - complementary (
Bool): Draw1 - F(x)(the survival function, falling from 1 to 0) instead ofF(x). What reliability and survival work reads: “what fraction lasted longer than this”.
Returns:
Chart[Ecdf]: Self, for further chaining.
mark_eventplot
fn def mark_eventplot(var self, line_length: Float64 = 1) -> Chart[Eventplot]A raster plot: one row of tick marks per series, each tick at the position of one event. Encoded via encode_eventplot(); see eventplot() for the one-call form.
Mark.RUG drawn once per row, against a categorical y-axis –
the chart for things that happen rather than things that have
a value. Every event is drawn where it happened; nothing is
bucketed the way histogram()/punchcard()/
calendar_heatmap() bucket it.
Args:
- self (
Self) - line_length (
Float64): Each tick’s height as a fraction of its row’s band, defaulting to1.0(the full band). Below 1.0 opens a gap between rows, which is the one lever against crowding that does not drop an event – checked at render() time, and must be positive.
Returns:
Chart[Eventplot]: Self, for further chaining.
mark_ridgeline
fn def mark_ridgeline(var self, bandwidth: Float64 = 0, scale_by_count: Bool = False, overlap: Float64 = 1.3) -> Chart[Ridgeline]A ridgeline plot: one overlapping kernel-density-estimate row per category, top to bottom. Encoded via encode_distribution(). bandwidth/scale_by_count work as in mark_violin(), applied to each row’s maximum rise instead of width.
Args:
- self (
Self) - bandwidth (
Float64): Overrides every category’s Silverman’s-rule kernel-density bandwidth with one shared value; must be positive if given. Left at its default0.0, each category gets its own Silverman’s-rule bandwidth. - scale_by_count (
Bool):False(the default,scale = "width") gives every category’s peak the same maximum rise;True(scale = "area") additionally scales a category’s maximum rise bysqrt(n_i / max(n)). - overlap (
Float64): How far each row’s silhouette may rise into the rows above it, as a multiple of the row height; defaults to1.3, deliberately more than one so the ridges interleave.
Returns:
Chart[Ridgeline]: Self, for further chaining.
mark_scatter3d
fn def mark_scatter3d(var self, elev: Float64 = 30, azim: Float64 = -60) -> Chart[Scatter3d]Select Mark.SCATTER3D: one marker per (x, y, z), drawn in an orthographic projection of a viewing cube (#345).
elev and azim are the view in degrees. They live on the
mark rather than on Theme because a view angle belongs to
this chart’s data the way a domain override does, not to a
house style.
Encoded via encode_xyz().
Args:
- self (
Self) - elev (
Float64): Degrees to look down on the scene from, above the x-y plane. - azim (
Float64): Degrees to turn the scene through, about the z axis.
Returns:
Chart[Scatter3d]: Self, for further chaining.
mark_plot3d
fn def mark_plot3d(var self, elev: Float64 = 30, azim: Float64 = -60) -> Chart[Plot3d]Select Mark.PLOT3D: the points joined in data order as one polyline through the cube (#345).
Not depth sorted, and it cannot be: a polyline is one connected path, so reordering its segments by depth would reorder the line. A segment passing behind another is drawn over it when it comes later in the series.
Args:
- self (
Self) - elev (
Float64): Degrees to look down on the scene from, above the x-y plane. - azim (
Float64): Degrees to turn the scene through, about the z axis.
Returns:
Chart[Plot3d]: Self, for further chaining.
mark_surface3d
fn def mark_surface3d(var self, elev: Float64 = 30, azim: Float64 = -60) -> Chart[Surface3d]Select Mark.SURFACE3D: a height field over a regular grid, drawn as filled faces shaded by height (#345).
Encoded via encode_surface(). elev/azim are the view in
degrees, as on mark_scatter3d().
Args:
- self (
Self) - elev (
Float64): Degrees to look down on the scene from, above the x-y plane. - azim (
Float64): Degrees to turn the scene through, about the z axis.
Returns:
Chart[Surface3d]: Self, for further chaining.
mark_wire3d
fn def mark_wire3d(var self, elev: Float64 = 30, azim: Float64 = -60) -> Chart[Wire3d]Select Mark.WIRE3D: the same height field as mark_surface3d(), drawn as the lattice’s lines with no fill (#345).
Nothing is opaque, so nothing occludes anything and there is no depth sort to get wrong. The far side of the surface stays visible, which is the reason to pick this over a surface and also why a dense lattice reads as a thicket.
Args:
- self (
Self) - elev (
Float64): Degrees to look down on the scene from, above the x-y plane. - azim (
Float64): Degrees to turn the scene through, about the z axis.
Returns:
Chart[Wire3d]: Self, for further chaining.
mark_trisurf3d
fn def mark_trisurf3d(var self, elev: Float64 = 30, azim: Float64 = -60) -> Chart[Trisurf3d]Select Mark.TRISURF3D: a surface over scattered points, triangulated in the x-y plane and lifted to z (#345).
Encoded via encode_xyz(), not encode_surface(): the input is
three loose columns, not a grid.
Args:
- self (
Self) - elev (
Float64): Degrees to look down on the scene from, above the x-y plane. - azim (
Float64): Degrees to turn the scene through, about the z axis.
Returns:
Chart[Trisurf3d]: Self, for further chaining.
mark_stem3d
fn def mark_stem3d(var self, elev: Float64 = 30, azim: Float64 = -60) -> Chart[Stem3d]Select Mark.STEM3D: a line from the base plane to each point, with a marker on the end (#345).
Encoded via encode_xyz(). The tether is what a plain 3D
scatter lacks: a floating marker’s height cannot be read,
because nothing says where under it the plane is.
Args:
- self (
Self) - elev (
Float64): Degrees to look down on the scene from, above the x-y plane. - azim (
Float64): Degrees to turn the scene through, about the z axis.
Returns:
Chart[Stem3d]: Self, for further chaining.
mark_quiver3d
fn def mark_quiver3d(var self, elev: Float64 = 30, azim: Float64 = -60) -> Chart[Quiver3d]Select Mark.QUIVER3D: an arrow at each point, along its own components (#345).
Encoded via encode_vectors3d(). The box is fitted to the
tips as well as the tails, since an arrow leaving it would read
as pointing at something outside the data.
Args:
- self (
Self) - elev (
Float64): Degrees to look down on the scene from, above the x-y plane. - azim (
Float64): Degrees to turn the scene through, about the z axis.
Returns:
Chart[Quiver3d]: Self, for further chaining.
mark_fill_between3d
fn def mark_fill_between3d(var self, elev: Float64 = 30, azim: Float64 = -60) -> Chart[FillBetween3d]Select Mark.FILL_BETWEEN3D: the ribbon joining two curves through space (#345).
Encoded via encode_ribbon3d(). Sample i of one curve joins
sample i of the other, so the pairing is the caller’s rather
than inferred.
Args:
- self (
Self) - elev (
Float64): Degrees to look down on the scene from, above the x-y plane. - azim (
Float64): Degrees to turn the scene through, about the z axis.
Returns:
Chart[FillBetween3d]: Self, for further chaining.
mark_bar3d
fn def mark_bar3d(var self, bar_width: Float64 = 0.80000000000000004, bar_depth: Float64 = 0.80000000000000004, elev: Float64 = 30, azim: Float64 = -60) -> Chart[Bar3d]Select Mark.BAR3D: one shaded box per sample, standing on the base plane (#345).
Encoded via encode_bars3d(). The footprints are fractions of
the closest spacing between two bars rather than absolute
sizes, so a lattice of bars leaves a gap without the caller
measuring their own grid.
Args:
- self (
Self) - bar_width (
Float64): The bar’s footprint along x, as a fraction of the closest spacing between two bars. - bar_depth (
Float64): The same along y. - elev (
Float64): Degrees to look down on the scene from, above the x-y plane. - azim (
Float64): Degrees to turn the scene through, about the z axis.
Returns:
Chart[Bar3d]: Self, for further chaining.
mark_voxels
fn def mark_voxels(var self, elev: Float64 = 30, azim: Float64 = -60) -> Chart[Voxels]Select Mark.VOXELS: a unit cube per filled cell of a solid occupancy grid (#345).
Encoded via encode_voxels(). Faces between two filled cells
are not drawn: they are inside the solid, so nothing outside it
can see them.
Args:
- self (
Self) - elev (
Float64): Degrees to look down on the scene from, above the x-y plane. - azim (
Float64): Degrees to turn the scene through, about the z axis.
Returns:
Chart[Voxels]: Self, for further chaining.