# Make a violin plot with only points

**URL:** <https://community.plotly.com/t/make-a-violin-plot-with-only-points/37412>\
**Category:** 📊 Plotly Python\
**Created:** [April 7, 2020, 9:35pm UTC](https://community.plotly.com/t/make-a-violin-plot-with-only-points/37412 "2020-04-07T21:35:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![willi2sr](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@willi2sr](https://community.plotly.com/u/willi2sr)\
**Post date:** [April 7, 2020, 9:35pm UTC](https://community.plotly.com/t/make-a-violin-plot-with-only-points/37412/1 "2020-04-07T21:35:48Z")

</div>

I really like sinaplots in R from ggforce ([https://ggforce.data-imaginist.com/reference/geom\_sina.html](https://ggforce.data-imaginist.com/reference/geom_sina.html)) and I’d like to recreate a similar plot with Plotly.py however there doesn’t seem to be a good solution. However, when looking at the plotly express documentation is seems that this plot ([https://plotly.com/python/violin/#violin-plot-with-box-and-data-points](https://plotly.com/python/violin/#violin-plot-with-box-and-data-points)) with points has exactly what I would like. Is there a way to remove the violin plot and only keep the points on the left?

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/3/370eee3fac2c0371560c8d66181e8927bd94b96b.png)

---

<div class="post-metadata">

**Author:** ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)\
**Post date:** [April 9, 2020, 5:14am UTC](https://community.plotly.com/t/make-a-violin-plot-with-only-points/37412/2 "2020-04-09T05:14:33Z")

</div>

Welcome @willi2sr  
The [strip plot](https://plotly.github.io/plotly.py-docs/generated/plotly.express.strip.html) might be what your looking for.

Let me know if that helps.

---

<div class="post-metadata">

**Author:** ![Emmanuelle](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/emmanuelle/32/7853_2.png) [@Emmanuelle](https://community.plotly.com/u/Emmanuelle)\
**Post date:** [April 9, 2020, 10:04am UTC](https://community.plotly.com/t/make-a-violin-plot-with-only-points/37412/3 "2020-04-09T10:04:24Z")

</div>

Thank you @adamschroeder! We should definitely add an example about this function (I was not aware of it!). For example

```auto
import plotly.express as px
df = px.data.tips()
fig = px.strip(df, x='day', y='tip')
fig.show()

```

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/3/3deadbeb88c71382be288cca7546b09113b605ea.png)

---

<div class="post-metadata">

**Author:** ![willi2sr](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@willi2sr](https://community.plotly.com/u/willi2sr)\
**Post date:** [April 9, 2020, 4:18pm UTC](https://community.plotly.com/t/make-a-violin-plot-with-only-points/37412/4 "2020-04-09T16:18:02Z")

</div>

@adamschroeder @Emmanuelle, thank you so much! this is exactly what I was looking for.

Addition: turns out it doesn’t deal with very many data points well. see below.

---

<div class="post-metadata">

**Author:** ![willi2sr](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@willi2sr](https://community.plotly.com/u/willi2sr)\
**Post date:** [April 9, 2020, 6:25pm UTC](https://community.plotly.com/t/make-a-violin-plot-with-only-points/37412/5 "2020-04-09T18:25:30Z")

</div>

Hi @Emmanuelle and @adamschroeder,  
Thanks again for your help here but it turns out px.strip is not exactly what I want because the density is not represented. I have a fair number of data points so it might be a bit harder I think with px.strip. I have an example below that shows how it would look plotting with `geom_sina` in R

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/b/b95cbcc8dd9ac6d3ee92be74c253b92d5bc95316.png)

vs. `px.strip` in python using

```auto
fig = px.strip(df, x = "xlab", y="ylab").update_traces(jitter = 0.9)

```

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/c/c4c92dbb5434944333ecfc104c039a28c4072231.png)

---

<div class="post-metadata">

**Author:** ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)\
**Post date:** [April 9, 2020, 6:51pm UTC](https://community.plotly.com/t/make-a-violin-plot-with-only-points/37412/6 "2020-04-09T18:51:39Z")

</div>

@willi2sr  
I think that’s due to the y\_axis range. If you fixed the y\_axis range on px.strip to [0,30000], I think you’ll get a similar image to the one using `geom_sina` in R

---

<div class="post-metadata">

**Author:** ![willi2sr](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@willi2sr](https://community.plotly.com/u/willi2sr)\
**Post date:** [April 9, 2020, 7:05pm UTC](https://community.plotly.com/t/make-a-violin-plot-with-only-points/37412/7 "2020-04-09T19:05:55Z")

</div>

That doesn’t seem to work either.  
`fig = px.strip(df, x = "x_lab", y="y_lab",range_y=[0,30000]).update_traces(jitter = 0.9)` gives the exact same plot. Any other ideas?

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/0/0a6a033f19c15329e9250492b537ceb9aa94b7ec.png)
