Zero-dependency Grammar of Graphics (ggplot2 + patchwork) visualization library for Geisha, with Pure-Geisha SVG (native / wasm32 / iOS) and Cross-Platform PNG (macOS CoreGraphics/CoreText 2x Retina + Linux pure-C99 AA software rasterizer) backends.
use plot.plot.{
ggplot, aes, x, y, color,
geomLine, geomSmooth, geomHline,
smoothLoess, se, lineWidth, dashed, dotted, colorHex,
labs, subtitle, legendBottom, themeMinimal,
saveSvg, savePng
}
let p = ggplot(tbl, aes([x("date"), y("nav"), color("asset")]))
+ geomLine([lineWidth(2.1)])
+ geomSmooth([smoothLoess(0.55), se(true), dashed()])
+ geomHline(100.0, [colorHex("#94A3B8"), dotted()])
+ labs("Asset NAV Curves", "Date", "NAV")
+ legendBottom()
+ themeMinimal();
let dashboard = vstackHeights([hstackWidths([pBox, pHeat], [1.1, 1.0]), pHist], [1.15, 0.95])
+ collectGuides()
+ plotAnnotation("Research Dashboard", "", "plot.gsa v0.1")
+ themeDark();
saveSvg(dashboard, 1080, 760, "dashboard.svg")?;
savePng(dashboard, 1080, 760, "dashboard.png")?;
let p = plot(tbl, [
aes([x("f1"), y("f2"), fill("corr"), label("lbl")]),
geomTile([]),
geomText([colorHex("#0F172A"), textSize(11.0)]),
scaleFillDiverging(),
labs("Factor Correlation Matrix", "", ""),
legendTitle("Corr"),
]);
- Zero External Package Dependencies: Pure-Geisha
PlotTable/PlotCol(ColFloat,ColInt,ColStr,ColBool,ColTime) + openconcept PlotSourcewith built-in instances forPlotTable,MutArray Float,List Float,(MutArray Float, MutArray Float),List (Float, Float), andList (String, Float). Works onnative,wasm32, andios. - 31 Geoms & Annotations:
- Core:
geomPoint,geomLine(sorted by x, breaks onNaN/Inf),geomPath(row-order),geomStep,geomArea,geomRibbon(grouped + breaks onNaN),geomCol,geomBar(trueStatCount),geomHist(grouped count/density) - Distributions & Diagnostics:
geomBoxplot(grouped/dodged),geomViolin(trimmed KDE + IQR/median),geomDensity(Silverman Gaussian KDE),geomEcdf,geomRug,geomQq(Normal Q-Q + reference line) - Intervals, 2D & Finance:
geomErrorbar,geomLinerange,geomPointrange,geomTile(discrete & continuous step width),geomRect,geomSegment,geomArrow,geomCandlestick,geomOhlc - Reference, Text & Smoothing:
geomHline,geomVline,geomAbline,geomText,geomLabel(pill background + nudge),geomSmooth(OLS / LOESS / Rolling + optional 95% SE band),annotateText,annotateRect,annotateSegment,annotateArrow
- Core:
- Positions:
positionIdentity,positionDodge,positionStack,positionFill(100% stacked),positionJitter - Visual Channels & Guides:
x,y,ymin/ymax,xmin/xmax,xend/yend,openPx/highPx/lowPx/closePx, independentcolorandfillscales (Okabe-Ito, Tableau10, Set2, Paired, Viridis, Plasma, Inferno, 0-anchored Diverging, RdYlGn, Grayscale, manual maps, 2/3-stop gradients), normalizedsize+ bubble legend,shape(7 markers + legend),linetype(4 dash styles + legend),alphaCol,group,label - Scales & Secondary Axis:
Linear,Log10,Symlog,Sqrt,Reverse, automatic UTC calendarTimescale, custom breaks & tick formats (FmtAuto,FmtFixed,FmtPercent,FmtCurrency,FmtSci,FmtCompact,FmtUnit, date/time formats), plus dual Y axis (secYAxisLinear,secYAxisAuto,onSecY) - Coords & Facets:
coordFlip,coordFixed,coordCartesian(viewport zoom without clipping stats),coordPolar/coordPie/coordDonut,facetWrap(Fixed / FreeX / FreeY / Free),facetGrid(rowCol, colCol) - Patchwork & Themes:
|,/,hstackWidths,vstackHeights, automatic panel edge alignment,collectGuides,plotAnnotation, 6 themes (Minimal,Gray,Bw,Dark,Classic,Void), and composablethemeOptsoverrides (legendBottom/Top/Left/Right,axisTextXAngle, grid toggles, spacing) - Backends: Pure-Geisha SVG (
toSvg,saveSvg) + macOS CoreGraphics/CoreText 2x Retina PNG + Linux zero-dependency pure-C99 AA software PNG (savePng,savePngScale)
Because plot.gsa has zero external dependencies, you can wrap a tabular.frame.DataFrame in 6 lines with zero array copies by passing its MutArray buffers directly into colFloat / colInt / colStr / colBool / tableFromCols.
MACOSX_DEPLOYMENT_TARGET=14.0 geisha check
MACOSX_DEPLOYMENT_TARGET=14.0 geisha test