Skip to content

core

Mojo package 🡭

core

Infrastructure the marks draw against: scales, frames, text, color and the small shared enums (#524).

Grouped apart from the chart families because it is a different axis entirely – none of it is a mark, and forcing it into a chart category would say something false about what it is for.

Nothing is re-exported here. Call sites import the module they need (from dataviz.core.scale import LinearScale), which keeps the dependency visible at the point of use rather than hiding it behind a package-level alias. The public surface is re-exported from dataviz/__init__.mojo and is unchanged by this grouping (#524).

Modules

  • annotations: The annotate_*() overlays: their stored data, their validation, and the six passes that draw them.
  • array_like: Adapters for data not stored as List[Float64] or List[String].
  • arrow: The arrowhead: one filled triangle at the tip of a directed line, shared by Plot.annotate_arrow() (annotations.mojo) and Mark.QUIVER (quiver.mojo) so the two draw the same head rather than each growing its own.
  • axis_controls: Explicit control over a continuous axis: where its ticks go, which direction it runs, and whether one data unit is the same length on both axes (#368).
  • axis_position: Where an axis line sits.
  • camera3d: The orthographic camera every 3D mark projects through: an elevation, an azimuth, and the map from a data-space point to a 2D position plus a depth (#345).
  • capabilities: What a mark honors and how it draws, as plain values (#829, #854). The MarkType trait carries the same facts as comptime constants; this is their runtime form for the checks that cannot see the type.
  • category_order: How a categorical mark orders its categories, set via Chart.sort_categories() (#843).
  • chart_settings: The settings every mark shares and no mark owns: the theme, the titles, the tooltip policy, the axis transforms and overrides, the color domain, and the two layering flags. Plot holds one as _settings (#826); a renderer reads what it needs from it and never the Plot.
  • cluster: Agglomerative clustering of a matrix’s rows: a distance, a linkage rule, the merge tree they produce, and the leaf order that tree implies (#355).
  • color_palette: Theme.categorical_palette’s type: a qualitative set of colors.
  • color_ramp: Theme.color_ramp’s type: a many-stop continuous gradient.
  • color_scale: ColorScale maps a continuous data domain onto a color gradient, for data-driven color encoding (Plot.encode(color=...)). Stop interpolation is shared with canvas.gradient’s LinearGradient/ RadialGradient through its GradientStops, which became public in canvas_mojo v0.18.0 (the same code was reached through _color_at_t/ _GradientStop/_insert_stop before). Only the projection differs: those project a pixel position onto the unit interval; this projects a data value, the way LinearScale does for position.
  • colormaps: Perceptually uniform sequential colormaps.
  • colors: Named colors: the full CSS Color Module Level 3 / X11 “extended color keywords” list (https://www.w3.org/TR/css-color-3/#svg-color) plus REBECCAPURPLE (Level 4), as Color constants, so Theme(mark_color=CORNFLOWERBLUE) works instead of Theme(mark_color=Color(100, 149, 237)).
  • delaunay: Delaunay triangulation of scattered points using Bowyer-Watson insertion.
  • extent: The padded data extents marks lay out against: linear, log, symlog, zero-baseline, and the x position extent a Plot resolves. Split out of plot.mojo.
  • fill_maps: Resolving a filled mark’s per-name color and pattern (#848): the chart’s fill_colors()/fill_patterns() first, then the palette and the pattern cycle by position.
  • frame: The axis frames: the plot rect, its ticks, gridlines and axis labels, for both a continuous and a categorical axis.
  • frame3d: The 3D frame: data ranges to a centred unit cube, the cube through a Camera3D, and the projection fitted to a plot rect (#345).
  • frame_input: Reading a dataframe_mojo column into the List[Float64]/ List[String] the rest of this package draws from (#364).
  • graph_layout: Where a graph mark places its nodes, a setting Plot.mark_graph() takes and _MarkStyle stores.
  • hatch: Pattern fills for filled marks (#842): hatch lines and dots drawn over a shape’s flat fill, so a series reads without its color.
  • legend: Legends: where they go, how wide they are, and the four kinds that get drawn.
  • legend_position: Where a legend sits relative to the plot area.
  • line_style: Dashed, dotted and dash-dot strokes.
  • mark: The geometric primitive a data row becomes: the grammar-of-graphics mark. Same small-struct-with-comptime-constants-and-__eq__ pattern as canvas.FillRule/canvas.TextAlign.
  • marker: Point-marker shapes used to distinguish categories without color alone.
  • mathtext: Mathematical labels: a small expression language for titles, axis captions, legend entries, tick labels and annotations (#371).
  • missing: What a chart does with a missing observation (#367).
  • numpy_interop: Convert numpy, pandas, MAX, and Python numeric arrays to Mojo floats.
  • ordinal_scale: OrdinalScale maps a fixed-order list of discrete categories onto evenly spaced pixel bands, the band scale every bar-chart-style categorical axis uses (like d3’s scaleBand, with a single padding fraction applied as an equal gap on both sides of every band).
  • output_format: Output formats supported by save(): SVG, PNG, BMP and PDF.
  • palettes: Named qualitative palettes for Theme.categorical_palette.
  • plot_fields: The channel and settings structs every mark shares, which Plot holds as fields: the continuous and categorical positions, the color, size and label channels, error bars, raw distributions, per-mark style settings, domain overrides and the title/axis labels. A struct only one mark family reads lives in that family’s file instead.
  • point_channels: The resolved color, shape and size channels of a point mark, built once per render so the legend reservation and the point layer agree.
  • render_result: What every _render_* function returns: the labels it deferred and the inner rect and scales it laid the mark out against. Read by the annotation passes and the label placement that run after the mark.
  • scale: LinearScale maps a continuous data domain onto a pixel range and picks “nice” tick positions within that domain for axis labeling. scale()/translate() compute the slope/intercept canvas.geometry.Transform2D’s affine map takes, so Plot builds a Transform2D from an x-scale and a y-scale (the y-scale’s range reversed, since pixel y increases downward).
  • stack_baseline: Where a stack of series sits on the y-axis.
  • stats: Statistical estimation shared by the marks that draw an estimate with its uncertainty – the start of the family #350 and #352 describe.
  • step_style: Step (stairs) interpolation for Mark.LINE.
  • text: Deferred text drawing and theme-scaled layout metrics.
  • theme: Visual defaults for a Plot (colors, sizes, margins) as one struct with defaults, rather than optional parameters scattered across Plot’s builder methods. A theme changes how a mark looks, not what it means. Every Color field takes a dataviz.core.colors constant as readily as a Color(r, g, b): Theme(mark_color=CORNFLOWERBLUE).
  • themes: Ready-made dark, minimal, high-contrast, and print-safe themes.
  • tooltip_labels: The hover text each kind of datum carries in SVG tooltips: a category and value, a series, a point, an xyz triple, a cell, a span, or an edge. Split out of plot.mojo, which imports every name here back.
  • tooltips: When a chart’s data gets SVG hover tooltips.
  • validate: Shared encoding and render-time validation.
  • x_label_rotation: Categorical x-axis label rotation modes.