deephaven / deephaven-plugins

Deephaven Plugins
5 stars 12 forks source link

feat: density heatmap #598

Open jnumainville opened 3 days ago

jnumainville commented 3 days ago

Fixes #22 This doesn't add every argument, but does add the core ones and trivial ones

I have not fully tested everything and I still need unit tests, hence this being a draft, but wanted to get out this in a draft.

Here is a good example of the basic ways this can be used, either with x, y, and histfunc="count", or x, y, z, and any histfunc, as well as other arguments to control the binning as, like histogram, how someone chooses to bin has a large impact on the visualization

import deephaven.plot.express as dx
from deephaven import new_table, agg

from deephaven import time_table

result = time_table(period="PT1S").update(["X = randomGaussian(10, 3)", "Y = randomGaussian(10, 3)", "Z = randomGaussian(10, 3)"])

density_heatmap = dx.density_heatmap(result, "X", "Y", title="Test", range_bins_x=[0, 20], range_bins_y=[0, 20], nbinsx=20, nbinsy=20)
density_heatmap_z = dx.density_heatmap(result, "X", "Y", "Z", title="Test", histfunc="std", range_bins_x=[0, 20], range_bins_y=[0, 20], nbinsx=5, nbinsy=5)