Real-time Plots
Whether your data is static or updating in real time, Deephaven supports plotting in Groovy via multiple its built-in plot package.
Basic plots
Deephaven's native plotting library supports many common plot types. To create a simple line plot that ticks in lock-step with the source table:
tLine = timeTable("PT0.2s").update("X = 0.05 * ii", "Y1 = X * sin(X)", "Y2 = 5 * X * cos(X)")
plotLine1 = plot("Y1", tLine, "Timestamp", "Y1").show()
Multiple series can be plotted together in the same figure.
plotLine2 = figure()
.plot("Y1", tLine, "Timestamp", "Y1")
.plot("Y2", tLine, "Timestamp", "Y2")
.show()
Plots with multiple axes
twinX
and twinY
allow you to create plots with multiple x
or y
axes. For example, you can use twinX
to create a plot with two different y
axes but a shared x
axis.
plotTwin = figure()
.newChart()
.plot("Y1", tLine, "Timestamp", "Y1")
.twinX()
.plot("Y2", tLine, "Timestamp", "Y2")
.show()
Subplots
Figures can also contain more than just one plot. For instance, a single figure could contain two plots stacked on top of one another, side by side, four plots in a 2x2 grid, and so on. These subplots are arranged into a grid, and then placed into specific locations in the grid with newChart
.
The example below creates a figure with two subplots side-by-side.
plotSub = figure(1, 2)
.newChart(0, 0)
.plot("Y1", tLine, "Timestamp", "Y1")
.newChart(0, 1)
.plot("Y2", tLine, "Timestamp", "Y2")
.show()
Far more plots are available, including histograms, pie charts, scatter plots, and more.