Miniplot GitHub ↗

Embedded Python API

Use typed arguments with a DuckDB connection configured by your application.

View the Python source

TimeSeriesChart

  • __init__(self, connection: DuckDBPyConnection)
  • line(self, times: list[datetime], values: list[float], *, title: str, width: int) → str

    Render finite measurements with up to four chronological points per time bin.

  • segments(self, times: list[datetime], values: list[float | None], *, width: int) → list[list[tuple[datetime, float]]]

    Reduce each uninterrupted section independently. None splits sections.

TimeSeriesDataset

Trusted main-schema relation, timestamp, unique tie-breaker and numeric series columns.

  • relation: str
  • time_column: str
  • order_column: str
  • measures: Mapping[str, str]

LineChartSpec

  • dataset_id: str
  • measure_id: str
  • start: datetime
  • end: datetime
  • width: int
  • title: str

BucketSize

  • MINUTE = 'minute'
  • HOUR = 'hour'
  • DAY = 'day'
  • MONTH = 'month'

BucketObservation

  • bucket: datetime
  • series_id: str
  • mean: float | None
  • observations: int

ChartBuilder

Resolve caller chart specifications against the host's dataset registry.

  • __init__(self, connection: DuckDBPyConnection, datasets: Mapping[str, TimeSeriesDataset])
  • line(self, spec: LineChartSpec) → str | None

    Project a half-open time window and reduce it before rendering.

  • bucketed_series(self, dataset_id: str, series: tuple[str, ...], start: datetime, end: datetime, *, size: BucketSize) → list[BucketObservation]

    Aggregate requested wide columns in one scan, then emit long rows.

StateInterval

  • start: datetime
  • end: datetime
  • state: str

StateTimeline

Compress consecutive equal events to half-open, bounded validity intervals.

  • __init__(self, connection: DuckDBPyConnection)
  • reduce(self, times: list[datetime], states: list[str | None], *, start: datetime, end: datetime, max_gap: timedelta) → list[StateInterval]

CalendarRange

  • start: date
  • end: date

CalendarDay

  • day: date
  • state: str
  • value: float | None
  • observations: int

CalendarData

Fill a date grid with separate observed, missing and out-of-coverage states.

  • __init__(self, connection: DuckDBPyConnection)
  • daily(self, times: list[datetime], values: list[float | None], *, displayed: CalendarRange, covered: CalendarRange, timezone_name: str) → list[CalendarDay]

MarketSession

  • session_id: str
  • start: datetime
  • end: datetime

QuoteTrade

  • time: datetime
  • sequence: int
  • price: float
  • volume: float

MarketBar

  • session_id: str
  • open: float | None
  • high: float | None
  • low: float | None
  • close: float | None
  • volume: float | None
  • trades: int

OHLC

Aggregate trades by explicit market sessions and tie-break on exchange sequence.

  • __init__(self, connection: DuckDBPyConnection)
  • bars(self, sessions: list[MarketSession], trades: list[QuoteTrade]) → list[MarketBar]

SeriesPoint

  • time: datetime
  • key: int
  • value: float | None

SeriesDifference

  • time: datetime
  • key: int
  • old: float | None
  • new: float | None
  • delta: float | None
  • ratio: float | None
  • state: str

TimeSeriesDiff

Align two chart revisions by timestamp and stable row identity.

  • __init__(self, connection: DuckDBPyConnection)
  • compare(self, old: list[SeriesPoint], new: list[SeriesPoint]) → list[SeriesDifference]
  • chart(self, old: list[SeriesPoint], new: list[SeriesPoint], *, title: str) → str

    Render measurements, differences and relative changes on separate charts.

SankeyLink

  • stage: int
  • source: str
  • destination: str | None
  • weight: float
  • collapsed: bool = False

SankeySummary

  • links: tuple[SankeyLink, ...]
  • stage_totals: tuple[tuple[int, float], ...]
  • invalid_rows: int

SankeyFlow

Summarize nonnegative movement between consecutive named stages.

  • __init__(self, connection: DuckDBPyConnection, relation: str)
  • summarize(self, *, minimum: float=0) → SankeySummary
  • expand(self, stage: int, source: str, *, minimum: float) → tuple[SankeyLink, ...]

    Return the original links represented by a collapsed source at one stage.

  • chart(self, *, title: str, minimum: float=0) → str

GridWindow

  • x_start: int
  • x_end: int
  • y_start: int
  • y_end: int

HeatmapCell

  • x: int
  • y: int
  • state: str
  • value: float | None

SparseHeatmap

Read a registered relation with unique (xbin, ybin) cell IDs.

  • __init__(self, connection: DuckDBPyConnection, relation: str, *, columns: int, rows: int)
  • sparse(self, window: GridWindow) → list[HeatmapCell]
  • dense(self, window: GridWindow) → list[HeatmapCell]

VoxelSpec

  • lower: tuple[float, float, float]
  • upper: tuple[float, float, float]
  • bins: tuple[int, int, int]

Voxel

  • cell: tuple[int, int, int]
  • count: int
  • center: tuple[float, float, float]
  • mean_color: float | None

VoxelPoint

  • point_id: int
  • position: tuple[float, float, float]
  • color: float | None

VoxelGrid

Aggregate three-dimensional points in a registered DuckDB table.

  • __init__(self, connection: DuckDBPyConnection, relation: str)
  • summarize(self, spec: VoxelSpec) → list[Voxel]
  • points(self, spec: VoxelSpec, cell: tuple[int, int, int], *, limit: int, after_id: int | None=None) → list[VoxelPoint]
  • chart(self, spec: VoxelSpec, *, title: str) → str

HierarchyNode

  • key: str
  • parent: str | None
  • label: str
  • weight: float | None = None

TreeMapArea

  • key: str
  • parent: str | None
  • label: str
  • depth: int
  • total: float

TreeMap

Build a leaf-weight hierarchy and render only the requested subtree depth.

  • __init__(self, connection: DuckDBPyConnection)
  • summarize(self, nodes: list[HierarchyNode], *, root: str, max_depth: int) → list[TreeMapArea]
  • chart(self, nodes: list[HierarchyNode], *, root: str, max_depth: int, title: str) → str

HistogramResult

  • counts: tuple[int, ...]
  • missing: int
  • outside: int

LogHistogramResult

  • edges: tuple[float, ...]
  • counts: tuple[int, ...]
  • missing: int
  • outside: int
  • nonpositive: int

ScatterExtent

  • xmin: float
  • ymin: float
  • xmax: float
  • ymax: float

DensityCell

  • column: int
  • row: int
  • count: int

ScatterSelection

  • visible_count: int
  • cells: tuple[DensityCell, ...]
  • points: tuple[tuple[float, float], ...]

ScatterDensity

Use a visible point budget to choose exact points or a compact count grid.

  • __init__(self, connection: DuckDBPyConnection)
  • fetch(self, x: list[float | None], y: list[float | None], extent: ScatterExtent, *, columns: int, rows: int, point_limit: int) → ScatterSelection

Histogram

Compute numeric bin counts on a host-provisioned DuckDB connection.

  • __init__(self, connection: DuckDBPyConnection)
  • count(self, values: list[float | None], edges: list[float]) → HistogramResult

    Use left-closed bins, including the right edge of the final bin.

  • count_log(self, values: list[float | None], *, lower: float, upper: float, bins: int) → LogHistogramResult

    Count exponentially spaced bins with returned edges in original units.

BoxSummary

  • group_id: int
  • count: int
  • q1: float | None
  • median: float | None
  • q3: float | None
  • lower_whisker: float | None
  • upper_whisker: float | None
  • outlier_count: int
  • outlier_examples: tuple[float, ...]

CategoryTotal

  • kind: str
  • category_id: int | None
  • label: str
  • total: float | None

DegreeCount

  • direction: str
  • degree: int
  • vertices: int

ErrorBarMethod

  • STANDARD_ERROR = 1.0
  • NORMAL_95 = 1.959963984540054

ErrorBar

  • group_id: int
  • count: int
  • mean: float | None
  • variance: float | None
  • lower: float | None
  • upper: float | None
  • method: ErrorBarMethod
  • reason: str | None

WeightedMean

  • group_id: int
  • weighted_sum: float
  • weight: float
  • mean(self) → float | None

GroupedStatistics

Return compact chart data computed on the host's DuckDB connection.

  • __init__(self, connection: DuckDBPyConnection)
  • boxplot(self, groups: list[int], values: list[float | None], *, outlier_limit: int=0) → list[BoxSummary]

    Use continuous quartiles, observed Tukey whiskers, and bounded outlier samples.

  • boxplot_html(self, groups: list[int], values: list[float | None], *, title: str, outlier_limit: int=0) → str

    Render the precomputed boxes as a Plotly trace.

  • top_categories(self, categories: list[int | None], values: list[float | None], labels: dict[int, str], *, limit: int) → list[CategoryTotal]

    Aggregate by stable ID and preserve distinct missing and remainder totals.

  • degree_distribution(self, vertices: list[int], edges: list[tuple[int, int, int]]) → list[DegreeCount]

    Count weighted directed degrees with one incoming and outgoing contribution per loop.

  • weighted_means(self, groups: list[int], values: list[float | None], weights: list[float]) → list[WeightedMean]

    Keep the numerator and valid weight for each group for later rollups.

  • combine_weighted_means(self, groups: list[WeightedMean], parents: dict[int, int]) → list[WeightedMean]

    Roll up summaries using only their two stored aggregate components.

  • error_bars(self, groups: list[int], values: list[float | None], *, method: ErrorBarMethod) → list[ErrorBar]

    Calculate sample variance and an interval around each group mean.