Skip to content
Polytope

Charts

A frame for charts drawn by any library: title, legend, plot, data table, source.

Experimental May change in any minor version before 1.0.


In this chapter 14 pages

Validation accuracy by epoch

Synthetic example data

  • Model A
  • Model B
  • Model C
0.300.450.600.750.90020406080100Model AModel BModel C
Data table
EpochModel AModel BModel C
00.4400.3600.340
100.5920.4770.520
200.6890.5630.620
300.7510.6270.674
400.7910.6740.704
500.8160.7100.720
600.8320.7360.729
700.8420.7550.734
800.8490.7690.737
900.8530.7800.738
1000.8550.7880.739
astro
<Chart title="Validation accuracy by epoch" subtitle="Five seeds, shaded band is one standard deviation"
  legend={[{ label: "GCN", shape: "line" }, { label: "SCN", shape: "line" }]} source="Source: our runs, 2026">
  <svg>...</svg>                                <!-- D3, Observable Plot, or hand-drawn -->
  <table slot="table" class="ply-table">...</table>
</Chart>
PropEffect
titleWhat the chart shows, as a statement or a question
subtitleUnits, sample, or how to read it
legendSeries: { label, slot, shape }. Shown for two or more series.
sourceWhere the data comes from
table slotThe same numbers as a table, behind a toggle

With D3 or Observable Plot

Read colors from the custom properties so charts follow the theme:

js
const css = getComputedStyle(document.documentElement);
const series = Array.from({ length: 8 }, (_, i) => css.getPropertyValue(`--ply-viz-${i + 1}`).trim());

Plot.plot({
  color: { range: series },
  style: { fontFamily: "var(--ply-font-text)", background: "transparent" },
  marks: [Plot.lineY(data, { x: "epoch", y: "acc", stroke: "model", strokeWidth: 2 })],
});

Static exports (paper figures) should use the token module instead, so the colors are fixed: import { viz } from "@dario-loi/polytope/tokens".

Tooltip and legend

.ply-tooltip is the black hover card used above; .ply-legend lists series with a dot, line, or bar key. .ply-texture adds a diagonal hatch for print and forced-colors mode.

The color rules live in Foundations: Charts.