⚠ Early release: v0.3.2.sophistry is not ready for production use. Until 1.0, any minor release may break the API; expect missing features and bugs too.Stability and versioning
Plotting and charts
Two families live here. The hand-built plots (Axes, FunctionGraph, PolarPlane, AreaUnderGraph, SecantSlopeGroup) place geometry in a coordinate system you control. The data-driven charts from @sophistry/charts (components BarChart, Histogram, Scatter, PieChart, … in @sophistry/solidjs/charts) take a data array plus channels that name which field feeds each quantity, and a <Chart> around them fits its axes to their data. Every chart batches its marks into a few nodes, so large datasets stay fast.
The examples are split by kind of chart below. Start with Function graphs and calculus for axes and graphs, and Bars, pies and part-to-whole for charts. Both reveal with the same draw() animation as any shape.
Function graphs and calculus
Axes, function and polar graphs, areas, tangents and vector fields.
- Sine and cosinePlot two functions on one set of axes and draw them in with draw().
- Log-scale axesA log y axis turns exponential growth into a straight line, with ticks on each decade. The graph plots through the same scale as the axis.
- Polar roseTrace the curve r = 3 cos 5θ on a polar grid by sweeping θ from 0 to π.
- Area under a curveRiemann rectangles are stacked ever more thinly until they fill the area under the curve.
- Secant to tangentShrink dx toward zero and the secant line through two points turns into the tangent.
- Vector fieldThe phase portrait of a pendulum as arrows colored by their length.
Bars, pies and part-to-whole
Bar, histogram, waterfall, funnel, waffle, mosaic, pie and gauge charts.
- Bar chart revealA bar chart whose bars grow in as draw() drives its progress.
- Horizontal bars<Bars> on a categorical y axis: names laid out top-down, bars growing from zero one after another, values counting up. Hover a bar.
- Grouped and stacked barsOne long-format table, two layouts of one bar mark: series colours the regions through the chart's scale and legend, the dodge layout puts them side by side in each quarter, the stack layout piles them up. The stack grows as one, so every frame is a true stacked chart.
- Value labels in stacked barslabels={{ position: "inside", total: true }} centres each segment's value in it, in whichever of dark and light text reads on its fill, and writes each stack's total past its end. Labels count up and grow in with their segments; one too small for its segment (the 1 in Q2) is left out.
- Diverging stacked barsA Likert chart from long-format rows: series="answer" with layout="stack" sends negative values down from zero and positive values up, so disagreement and agreement grow apart from one centre line, and the chart's colour scale gives the legend in answer order. The question axis stands at the left edge, clear of the bars, and a zero line marks the baseline they grow from.
- Histogram binsThe same 120 samples regrouped into more and more bins, from coarse to fine.
- WaterfallHow a starting figure became a final one: each change grows from where the last left off.
- Bullet chartStephen Few's bullet graph: four KPIs against their targets over poor / fair / good bands, each on its own scale. The bands fade in first, then each bar grows from zero and its target marker draws in.
- FunnelStages of a process, top-down: each widens out from the centre, the loss between them shaded.
- Waffle chartA 10 × 10 waffle where each cell is one percent, filling from the bottom-left like a container. Counts use largest-remainder rounding, so they always add up to 100.
- Mosaic (Marimekko) chartSales by region × product: each column is as wide as its region's share of the market, split by product mix, so every tile's area is its sales. Region names fade in first, then the columns grow left to right.
- Pie and radar chartsA doughnut chart and a two-series radar chart, both built from plain data and revealed together: the doughnut's slices open together from 12 o'clock, each pushed round by the ones before, while the radar's polygons grow out of the centre. ariaLabel gives each slice an accessible name.
- KPI gauge and radial barsA gauge with threshold bands and a needle, beside activity rings. Each draws its track first, then sweeps clockwise while the readout counts up.
Lines, areas and time series
Line and area charts, time axes, stacks, streamgraphs and candlesticks.
- A chart that fits itself<Chart> ranges its axes from the layers inside it, then draws the frame before the data.
- Line and area curvesThe same readings drawn three ways: a monotone curve (smooth, but never overshooting a reading) over a monotone band, a straight polyline, and a step-after line that holds each value until the next. Curves are native Béziers, and the reveal cuts them along x without straightening them.
- Series and a generated legendOne long-format dataset split by series: a line and markers per city, one colour per city from the chart's scale, and a legend that arrives after the data it explains.
- Time seriesNative Dates make a UTC time axis that ticks on month boundaries and writes dates.
- Annotated seriesMarks layered in one chart: a shaded span, a target rule, the series, labelled points with tooltips.
- One reveal frontreveal="x" sweeps a single clip edge across the plot, so the band, the line and its markers enter together, at a constant rate along x.
- Two y axesRainfall as bars on the left axis and temperature as a line on a secondary axis on the right. Layers inside SecondaryY share the month axis and the reveal but fit their own scale, aligned with alignTicks so its ticks sit on the left axis's grid lines, and the frame makes room for the right-hand numbers inside its width.
- Stacked areasWide-format rows (one object per x) become stacked bands: y takes one channel per band, mixing keys and functions, and series names them, so the bands take the chart's colours and legend.
- StreamgraphStackPlot with offset="wiggle" and order="insideOut": the layers float around a centre line chosen to keep them as level as possible, and the whole stream grows out of it. The week axis sits at the bottom edge (xAxis position) rather than through the stream, and series names the bands for the legend.
- CandlesticksPrices on a time axis (inferred from Dates): each wick draws low to high, then the body grows from the open to the close.
Scatter and distributions
Scatter plots, fits, strip and swarm plots, boxes, violins and densities.
- Scatter with error barsMeasurements as points with a symmetric error bar on each: every point fades in where it stands and its bar grows out of it, left to right.
- Regression with a confidence bandOne least-squares fit per series, each with the 95% band of its mean, narrowest at the centre of its data. The series channel splits the fits and colours fits and points alike, keyed by one legend; every line and band sweeps in along x behind one front.
- Robust LOESS smoothA local regression with its 95% band, through a noisy daily series with a few bad readings. The plain smooth bends toward the outliers and its band balloons; robustness iterations re-weight them away.
- Strip plot and beeswarmEvery observation as a dot, coloured by cohort through the chart's series scale and legend. A strip plot spreads them by seeded jitter (the same on every frame); a beeswarm packs them so none overlap. Dots appear in place, low values first.
- Box and violin plotsThe same three samples summarised two ways: quartile boxes that open out of their medians, and kernel-density violins that widen out of their centre lines.
- Grouped box plotsBox plots split by a series, seaborn's hue: the boxes sharing a dose stand side by side in its slot, and a dodged strip of the raw readings sits over each box. One colour scale and one legend serve both.
- Density with a rugOne kernel density estimate per series (morning and evening waits, from one long-format sample), both sweeping in along x behind one front, with the raw sample as a rug of ticks standing on the axis, in the same series colours, drawn in value order.
- RidgelineOne Density over long-format rows, with series="month" and row: each month's curve stands on its own row of a band y axis and rises into the one above, so the shift in the distribution month by month reads as a landscape. The month axis stands at the left edge, clear of the curves, though the temperatures cross zero, and reveal="x" uncovers every ridge behind one shared front.
- Parallel coordinatesFour car measurements side by side: each car is a line across the axes, drawn left to right once the axes are in.
Facets and linked views
Small multiples, pair and joint plots, and brushes that drive other charts.
- Small multiples with shared scalesOne panel per island from a single long-format table. The panels share both scales, so the clusters compare across the row, and only the outer panels write numbers; the species colours come from one scale with one legend. Every frame draws first, then the panels fill left to right.
- A row × column facet gridOne table split two ways: years down the rows, islands across the columns. Each row's year is written once in the right margin and each island once over the top row, the panels share both scales, and one legend runs along the top.
- Facet grid with x shared down each columnscales={{ x: "column" }} gives each travel mode its own distance axis, shared by the rows below it (ggplot's facet_grid with scales = "free_x"), and space="free" sizes each column by its range, so a kilometre is one length across the grid. Time stays shared.
- Facet panels sized by their categoriesEach department has its own teams, so the x axes are independent; space="free" makes each panel as wide as its number of bars, so every bar is the same width and the panels read as one row of bars. The value axis is shared.
- Pair plotEvery pair of three measurements against each other, each measurement's density on the diagonal. Panels in a column share x and panels in a row share y, so a flower lines up across the matrix; only the bottom row and left column write numbers and names.
- Scatter with marginal densitiesA joint plot: two groups in a scatter, with each variable's density along its edge, the right-hand one a vertical density, values up y. The marginals follow the scatter's scales, so the curves line up with the points, and they are normalised together, so each curve's area is its group's share and the larger group stands taller.
- Brushing linked chartsAn overview with a draggable range brush drives two detail charts linked on x. The brush writes two tracks and the link reads them, so dragging it, using the arrow keys, or animating the tracks (as here) zooms both details together, and scrubbing the timeline replays it.
- Brushing a box on both axesA two-dimensional brush on the left selects a box of the cloud and the chart on the right zooms to it. Drag the box, an edge or a corner, or Tab to it and use the arrow keys; the four tracks it writes are the right chart's ranges, animated here.
- Brushing categories on a band axisOn a category axis the brush snaps to whole bars, and an arrow key moves it one bar. brushedCategories turns its two tracks into the months it covers, which the chart below breaks down by product.
Heatmaps and contours
Gridded and scattered fields as colour, iso-lines and colour norms.
- Annotated heatmapCategorical rows and columns, a colormap, and each value written in a colour that reads on its cell.
- Heatmap with contoursA grid of values colored as a heatmap, with iso-lines of the same field drawn over it.
- Clustered heatmapHours of use per app and weekday, clustered both ways by average linkage: similar apps and similar days move next to each other, and each dendrogram replays its merges, closest first, as the cells fade in.
- Log and diverging colour normsA field spanning four decades on a log norm, and temperature anomalies on a diverging norm centred on zero, each with a colour bar that follows its norm.
- Contours from scattered samplesReadings at scattered stations, triangulated: after the frame, the faces fade in as a wave from the top-left while the contour lines draw level by level, lowest first.
Hierarchies, networks and flows
Treemaps, sunbursts, trees, network layouts, Sankey and chord diagrams.
- TreemapA squarified treemap of a source tree: tiles fade in folder by folder, coloured by top-level folder.
- SunburstA sunburst of a monthly budget, revealed by one clockwise sweep from 12 o'clock.
- DendrogramA cluster dendrogram of a small taxonomy: elbow links grow out of the root one level at a time, leaves aligned on the right.
- Radial dendrogramA small family of languages as a radial cluster tree: the root in the centre, every language on the outer ring, links growing out level by level.
- Treemap data transitionOne budget, two years. Tiles are matched by their path of names: the team that was cut fades out, the others resize into place, the new team fades in. One blend track drives it, so it scrubs. Data order and an order-keeping tile keep every frame a clean tiling.
- Treemap transition that keeps its rowsThe values reorder, so a fresh squarify would re-row the tiles and slide them across each other. tile="resquarify" lays the new values out in the old rows instead: every tile keeps its neighbours and every frame is a clean tiling, at the cost of the end not being the plain squarified layout.
- Sunburst drill-downZooming into one branch of a sunburst and back out: the focus is a transition between two nodes driven by one track, so the zoom scrubs like any other animation. The chosen branch becomes the centre and its children open out round the whole turn.
- Tree data transitionA reorganisation as a node-link tree. Nodes are matched by their path of names: the team that was wound up draws back into its parent, the rest slide to their new places with their links following, then the new teams grow out of theirs. One blend track drives it, so it scrubs.
- Network layoutsOne set of vertices and edges placed three ways by changing only the layout prop.
- Sankey diagramEnergy flowing from sources to uses: nodes appear column by column, then the flows draw left to right.
- Chord diagramMigration between four regions: the ring sweeps round like a pie, then each chord fades in, as wide at each end as the flow leaving it.
- Directed chord diagramWho emails whom: one chord per direction, each as wide at both ends as its flow, ending in an arrowhead on the team it reaches. A team that only receives still gets its arc.
Chart transitions
Data that morphs, keyed updates, rescaling axes, sorting, races and streams.
- Morphing chart dataCharts redraw from their data, so animating the data animates the chart: one blend track mixes two datasets and every bar follows.
- Line morph in data spaceEach line morphs on one shared x grid, so values move vertically and a line that gains data grows at its end; the old forecast fades out, the new series sweeps in, and the axes rescale with them.
- Stacked area morphEach end is stacked on its own and every band's two edges morph together on one shared x grid, so each frame is still a stack: a leaving band shrinks and the bands above settle onto it, a new one grows in its place.
- Bars into a scatterOne blend track turns a bar chart into a scatter plot: the bars shrink away, the category axis cross-fades into a number line, and the dots on the bars' tops slide to their new places in scene units while the y axis glides to the new axis's zero. Played forward, then back.
- Animated axis rescaleOne track drives the y domain and the data together, shared by the axis, the grid and the marks: the values grow tenfold as the axis rescales under them, so the points barely move while the numbers change. Ticks on both ends slide, the rest cross-fade, and labels that would crowd fade out as they close up.
- Keyed scatter updateOne blend track joins two datasets by key: Lima shrinks away where it stood, the fitted y axis grows, matched cities move in data space, then Oslo grows in. Played forward, then scrubbed back.
- Keyed bubbles with a staggered entranceBubbles sized by population through the `size` channel (area ∝ value), keyed by the frame's size legend, blend to a later year by key: Lima shrinks away, the others move and resize, then three new cities grow in one after another, left to right (`enterStagger`). Only the entrance is staggered; the moves stay together, so they are easy to follow.
- Keyed beeswarm updateWeek 1 to week 6 of a trial on one blend track: participants who drop out shrink away, everyone else slides from their place in the first swarm to their place in the second (both ends packed), then a new arm's band opens and its dots grow in.
- Keyed box plot updateOne blend track joins two years of trial arms by name: placebo closes into its median, the fitted axis grows, the matched arms' quartiles and whiskers move in data units, then a new arm opens. Played forward, then scrubbed back.
- Keyed pie morphOne blend track joins two years of browser share by name: IE's slice closes and its neighbours take the room, the shares change in data space, then Edge opens where the new year has it. Every frame is a whole pie.
- Radar with a changing axis setTwo phones rated on five axes, then on a new set of five. Axes are matched by name: Weight and Price fold away, every polygon's corner on them flattening into its edge, the shared axes turn to their new places, then Camera and Repair unfold. The polygons blend axis by axis on the same track.
- Sorting bars with slotsA slots model owns the order; the chart's band axis reads each category's slot through `slot`, so bars and their names slide together. Each sort is one seekable `permute`, staggered.
- Bar chart raceValues interpolate between yearly keyframes, ranks come from the interpolated values, and each overtake slides on its own short ease. The category axis follows the ranks through its `slot`, so names ride with their bars, and only the top five are shown: whoever drops out slides under the last place and out of view.
- Animated scatter with trailsTime as an encoding, Gapminder-style: one marker per country at the moment `at`, sized by population (area ∝ value, the `size` channel) and interpolated between decades, with a trail of the path it took. The axes fit every decade, so they hold still while time plays.
- Streaming seriesNew samples arrive off-screen right and the x domain slides left under a clip; the leaving tick fades out. Everything is a function of one time track, so it scrubs.