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

add swarm plot #4021

Open
nicolaskruchten opened this issue Jul 5, 2019 · 3 comments
Open

add swarm plot #4021

nicolaskruchten opened this issue Jul 5, 2019 · 3 comments
Labels
feature something new P3 not needed for current cycle

Comments

@nicolaskruchten
Copy link
Contributor

Placeholder issue for a 'swarm' trace type that would behave much like box with and invisible box and points: "all"and some more-controllable jittering/overlap-avoidance options.

@tsloan1377
Copy link

I needed to recreate a swarm plot in Plotly graph_objects for a project, effectively using a boxplot with invisible boxes was the way to go.

Posting the code here in case someone follows my same steps to this thread:

import plotly.graph_objects as go
import numpy as np

np.random.seed(1)
y0 = np.random.randn(50) - 1
y1 = np.random.randn(50) + 1

fig = go.Figure()
fig.add_trace(go.Box(y=y0, 
                     opacity=1,
                    fillcolor="rgba(0,0,0,0)",
                    boxpoints="all",
                    jitter=0.8,
                    line={
                        "width": 0
                    },
                    pointpos=0))
fig.add_trace(go.Box(y=y1, 
                    boxpoints="all",
                    fillcolor="rgba(0,0,0,0)",
                    jitter=0.8,
                    line={
                        "width": 0
                    },
                    pointpos=0))

fig.update_layout(showlegend=False)
fig.show()

newplot (6)

@nicolaskruchten
Copy link
Contributor Author

Thanks Tyler! This is in effect what px.strip() does: https://plotly.com/python/strip-charts/

@franktoffel
Copy link

What's the current status of this?

Do you have any plans to include beeswarm plots?

This is a very common visualization:
https://community.plotly.com/t/shap-like-bee-swarm-plots/68015
https://datascience.stackexchange.com/questions/71709/how-is-the-beeswarm-plot-better-than-a-histogram

@gvwilson gvwilson self-assigned this Jul 5, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson changed the title Swarm plot add swarm plot Aug 8, 2024
@gvwilson gvwilson added feature something new P3 not needed for current cycle labels Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 not needed for current cycle
Projects
None yet
Development

No branches or pull requests

4 participants