Skip to content

density_scatter_plotly() #161

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

Merged
merged 5 commits into from
Jun 20, 2024
Merged

density_scatter_plotly() #161

merged 5 commits into from
Jun 20, 2024

Conversation

janosh
Copy link
Owner

@janosh janosh commented Jun 19, 2024

closes #160

minimal example

import pandas as pd
import plotly.express as px
from sklearn.datasets import make_blobs

from pymatviz import density_scatter_plotly
from pymatviz.templates import pmv_white_template


px.defaults.template = pmv_white_template

xs, ys = make_blobs(n_samples=1_000_000, centers=3, n_features=2, random_state=42)

x, y = "feature1", "feature2"
df_blobs = pd.DataFrame(data=xs, columns=[x, y])
df_blobs["target"] = ys

fig = density_scatter_plotly(df=df_blobs, x=x, y=y)
fig.show()

density-scatter-plotly

TODO few tests still failing due to misuse of annotate()
@janosh janosh added plotly Concerning plotly-powered functions scatter Scatter plots examples New or improved usage examples labels Jun 19, 2024
janosh added 4 commits June 20, 2024 10:25
all functions were more conveniently importable from __init__.py (e.g. from pymatviz import density_scatter) so hopefully doesn't affect many users
add keyword bin_counts_col: str = 'point density' to override color bar title
@janosh janosh merged commit eb8fd62 into main Jun 20, 2024
5 of 6 checks passed
@janosh janosh deleted the density-scatter-plotly branch June 20, 2024 15:02
@janosh janosh added the breaking Breaking changes label Jun 20, 2024
janosh added a commit that referenced this pull request Mar 28, 2025
* first swing at density_scatter_plotly() to close #160

TODO few tests still failing due to misuse of annotate()

* breaking: rename parity module to scatter

all functions were more conveniently importable from __init__.py (e.g. from pymatviz import density_scatter) so hopefully doesn't affect many users

* add assets for density_scatter_plotly snd show in readme

add keyword bin_counts_col: str = 'point density' to override color bar title

* compress new SVG assets

* fix ptable-scatter assets, seemingly broken by SVG compression

noticed by @DanielYang59 in https://github.com/janosh/pymatviz/pull/158/files#r1643591862
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking changes examples New or improved usage examples plotly Concerning plotly-powered functions scatter Scatter plots
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add density_scatter_plotly
1 participant