# Placing dotplot over violin plot

**URL:** <https://discourse.julialang.org/t/placing-dotplot-over-violin-plot/115253>\
**Category:** Visualization\
**Tags:** plotting, statsplots\
**Created:** [June 5, 2024, 7:16pm UTC](https://discourse.julialang.org/t/placing-dotplot-over-violin-plot/115253 "2024-06-05T19:16:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max\_Beez](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@Max\_Beez](https://discourse.julialang.org/u/Max_Beez)\
**Post date:** [June 5, 2024, 7:16pm UTC](https://discourse.julialang.org/t/placing-dotplot-over-violin-plot/115253/1 "2024-06-05T19:16:20Z")

</div>

I am trying to create a violin plot with the individual data points overlayed over the violin plot. IF I create a violin using `Plots.violin(data)` and then `dotplot!(data)` I get a result of side-by-side rather than overlayed.

 ![Screenshot 2024-06-05 at 3.41.02 PM](https://global.discourse-cdn.com/julialang/original/3X/3/c/3c41e419825a3619eb0098b7c716138f991a76e8.png)

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [June 5, 2024, 8:13pm UTC](https://discourse.julialang.org/t/placing-dotplot-over-violin-plot/115253/2 "2024-06-05T20:13:16Z")

</div>

Typically, `plot!` and other varieties overlay on an existing plot, unless a subplot is specified. I think this is probably a bug.

---

<div class="post-metadata">

**Author:** ![Max\_Beez](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@Max\_Beez](https://discourse.julialang.org/u/Max_Beez)\
**Post date:** [June 5, 2024, 8:21pm UTC](https://discourse.julialang.org/t/placing-dotplot-over-violin-plot/115253/3 "2024-06-05T20:21:07Z")

</div>

I think so as well. I’ll make a submission.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [June 5, 2024, 8:24pm UTC](https://discourse.julialang.org/t/placing-dotplot-over-violin-plot/115253/4 "2024-06-05T20:24:46Z")

</div>

If you don’t mind, please post a link to the issue in case someone needs to cross reference it in the future.

---

<div class="post-metadata">

**Author:** ![Max\_Beez](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@Max\_Beez](https://discourse.julialang.org/u/Max_Beez)\
**Post date:** [June 5, 2024, 8:32pm UTC](https://discourse.julialang.org/t/placing-dotplot-over-violin-plot/115253/5 "2024-06-05T20:32:27Z")

</div>

Issue: [Dotplot not overlaying violin plot · Issue #54695 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/54695#issue-2336781617)

---

<div class="post-metadata">

**Author:** ![gilles75-LDG](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gilles75-ldg/32/214876_2.png) [@gilles75-LDG](https://discourse.julialang.org/u/gilles75-LDG)\
**Post date:** [January 22, 2025, 9:43pm UTC](https://discourse.julialang.org/t/placing-dotplot-over-violin-plot/115253/6 "2025-01-22T21:43:26Z")

</div>

Sorry for dragging up an old conversation.

I’m pretty sure that to get the intended behaviour, you would need to specify an x coordinate for your plots. Otherwise, the default is to increment each of these by 1. In this example, `Plots.violin([1],data)` and `dotplot!([1],data)` might give the result you’re looking for.

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [January 23, 2025, 3:42pm UTC](https://discourse.julialang.org/t/placing-dotplot-over-violin-plot/115253/7 "2025-01-23T15:42:41Z")

</div>

yes
