Real-time Plots

Whether your data is static or updating in real time, Deephaven supports plotting in Groovy via its built-in plot package.

Basic plots

The built-in plotting library supports many common plot types. To create a simple line plot that ticks in lockstep with the source table, pass a series name, the table, and its x and y columns to plot, then call show to display the plot. The series name labels the line in the plot's legend:

A ticking line plot

A figure is the container that holds one or more plots. To plot multiple series together in the same figure, start from figure and chain plot calls:

A ticking plot with multiple series

Plots with multiple axes

twinX adds a new set of axes that shares the current x axis, so the plot gets a second y axis. twinY does the same with a shared y axis, which gives a second x axis. The example below uses twinX to plot Y1 and Y2 against one x axis, each with its own y axis.

A ticking plot with two y axes that share an x axis

Subplots

So far, each figure has held a single plot, even when that plot has several series. A figure can also hold several plots arranged in a grid. For instance, a single figure could contain two plots stacked vertically, two plots side by side, or four plots in a 2x2 grid. To create these subplots, pass the number of rows and columns in the grid to figure, then place each plot in a cell with newChart, whose row and column indices start at 0.

The example below creates a figure with two subplots side by side.

Two subplots, displayed side by side

More plot types

Far more plots are available in the built-in plot package, including histograms, pie charts, and scatter plots.

Tip

Prefer a no-code approach? Use the Chart Builder to create line, bar, scatter, and pie charts from any table directly in the UI.