Open nicolaskruchten opened 5 years ago
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()
Thanks Tyler! This is in effect what px.strip()
does: https://plotly.com/python/strip-charts/
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
Placeholder issue for a 'swarm' trace type that would behave much like
box
with and invisible box andpoints: "all"
and some more-controllable jittering/overlap-avoidance options.