an open-source visualization library for Python and JavaScript
import { Chart, layer, selectAll } from "gofish-graphics"; layer([ Chart(seafood) .flow( spread({ by: "lake", dir: "x", spacing: 64 }), derive((d) => orderBy(d, "count", "asc")), stack({ by: "species", dir: "y" }) ) .mark(rect({ h: "count", fill: "species" }).name("bars")), Chart(selectAll("bars")) .flow(group({ by: "datum.species" })) .mark(area({ opacity: 0.8 })), ]).render(el, { w: 400, h: 400, axes: true });
from gofish import chart, Layer, selectAll Layer([ chart(seafood) .flow( spread(by="lake", dir="x", spacing=64), derive(lambda d: sorted(d, key=lambda r: r["count"])), stack(by="species", dir="y"), ) .mark(rect(h="count", fill="species").name("bars")), chart(selectAll("bars")) .flow(group(by="datum.species")) .mark(area(opacity=0.8)), ]).render(w=400, h=400, axes=True)