Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: density heatmap #598

Merged
merged 11 commits into from
Jul 16, 2024
Merged

Conversation

jnumainville
Copy link
Collaborator

@jnumainville jnumainville commented Jul 3, 2024

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

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)

@jnumainville jnumainville requested a review from mofojed July 3, 2024 20:35
@jnumainville jnumainville self-assigned this Jul 3, 2024
@jnumainville jnumainville marked this pull request as ready for review July 10, 2024 19:12
@jnumainville
Copy link
Collaborator Author

Put this up for review but going to add one more arg

      default_bin_value: The value to use for bins that have no data.
        If None and histfunc is 'count' or 'count_distinct', 0 is used.
        Otherwise, if None or 'NaN', NaN is used.

Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some other density_heatmap functions I tested with, adapted from https://plotly.com/python/2D-Histogram/#density-heatmaps-with-plotly-express:

import deephaven.plot.express as dx
tips = dx.data.tips()
f_tips = dx.density_heatmap(tips, x="total_bill", y="tip")
f_tips2 = dx.density_heatmap(tips, x="total_bill", y="tip", nbinsx=20, nbinsy=20, color_continuous_scale="Inferno")

iris = dx.data.iris()
f_iris = dx.density_heatmap(iris, x="petal_length", y="petal_width", z="sepal_length", histfunc="avg")

@mofojed mofojed merged commit 8fb924d into deephaven:main Jul 16, 2024
14 checks passed
jnumainville added a commit that referenced this pull request Jul 25, 2024
Fixes #608 
#598 should be merged first

Adds some initial density heatmap docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add density heatmap
2 participants