Figure API & Core Charts
Axes
An Axes represents a single plot area within a Figure.
Figure
A Figure represents the entire plotting canvas.
Render a figure to SVG or PNG.
Save a figure to disk as SVG, PNG, or PDF.
Plot a connected line series on the current axes.
Plot unconnected points on the current axes.
Plot vertical bars on the current axes.
Plot horizontal bars on the current axes.
Draw a horizontal line across the current axes at the given y value.
Draw a vertical line across the current axes at the given x value.
Plot stacked vertical bars for multiple series on the current axes.
Plot grouped (side-by-side) vertical bars for multiple series on the current axes.
Plot a histogram on the current axes.
Plot a box-and-whisker summary on the current axes.
Plot a violin summary on the current axes.
Plot a pie chart on the current axes.
Show or configure a legend on the current axes.
Plot a heatmap for a 2D tensor.
Display a matrix as an image (alias of heatmap).
Plot contour lines for a 2D grid.
Plot filled contours for a 2D grid.
Set the global plot theme.
Get the current plot theme.
Reset the theme to default.
List available theme names.
Create a 3D surface plot.
Create a 3D wireframe plot.
Create a 3D scatter plot.
Create a new figure and set it as current.
Get the current axes, creating one if needed.
Create a subplot and set it as current axes.
Get a named color palette.
Get a color from a named palette by index (wraps around).
List all available palette names.
import { figure, gca, saveFig, setTheme, wireframe,} from "deepbox/plot";import { tensor } from "deepbox/ndarray";const fig = figure({ width: 800, height: 400 });const ax = gca();const x = tensor([1, 2, 3, 4]);const y = tensor([2, 3, 5, 4]);setTheme("paper");ax.plot(x, y, { color: "#0f766e", label: "trend" });ax.bar(x, tensor([1, 2, 2, 3]), { color: "rgba(148, 163, 184, 0.5)" });wireframe( [ [-1, 1], [-1, 1], ], [ [-1, -1], [1, 1], ], [ [0, 1], [1, 0], ], { color: "#334155" });ax.legend();await saveFig("example.svg", { figure: fig });