Real-time Plots

Whether your data is static or updating in real time, Deephaven supports plotting via multiple libraries, including its own built-in plotting API.

Basic plots

Note

Plotting with pip-installed Deephaven from Jupyter requires some additional setup you can read about here.

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:

from deephaven import time_table
from deephaven.plot.figure import Figure

t_line = time_table("PT0.2s").update(
    ["X = 0.05 * ii", "Y1 = X * sin(X)", "Y2 = 5 * X * cos(X)"]
)

plot_line_1 = Figure().plot_xy(series_name="Y1", t=t_line, x="Timestamp", y="Y1").show()

img

Multiple series can be plotted together in the same figure.

plot_line_2 = (
    Figure()
    .plot_xy(series_name="Y1", t=t_line, x="Timestamp", y="Y1")
    .plot_xy(series_name="Y2", t=t_line, x="Timestamp", y="Y2")
    .show()
)

img

Plots with multiple axes

x_twin and y_twin allow you to create plots with multiple x or y axes. For example, you can use x_twin to create a plot with two different y axes but a shared x axis.

plot_twin = (
    Figure()
    .new_chart()
    .plot_xy(series_name="Y1", t=t_line, x="Timestamp", y="Y1")
    .x_twin()
    .plot_xy(series_name="Y2", t=t_line, x="Timestamp", y="Y2")
    .show()
)

img

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 new_chart.

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

plot_sub = (
    Figure(rows=1, cols=2)
    .new_chart(row=0, col=0)
    .plot_xy(series_name="Y1", t=t_line, x="Timestamp", y="Y1")
    .new_chart(row=0, col=1)
    .plot_xy(series_name="Y2", t=t_line, x="Timestamp", y="Y2")
    .show()
)

img

Far more plots are available, including histograms, pie charts, scatter plots, and more. Deephaven also offers integrations with Plotly-express, Matplotlib, and Seaborn that are under active development.