<p>wish there was a more subtle answer, but this works.  Place this previous to your VlnPlot</p>
<pre class="lang-r prettyprint-override"><code>update_geom_defaults(&quot;violin&quot;, aes(linewidth = 0))
</code></pre>

CC BY-SA 4.0
2023-04-11T18:56:17.427Z
2023-04-11T19:25:29.093Z
2023-04-11T19:25:29.093Z
Nathan Siemers
<pre class="lang-r prettyprint-override"><code>vln_df = data.frame(gene = ilc2_bs[[&quot;RNA&quot;]]@data[ &quot;gene&quot;, ],
                    group = ilc2$group)

ggplot(vln_df, aes(x = group, 
                   y = gene, fill = group)) + 
  geom_violin(aes(fill = group, 
                  color = gene),
              color = NA) +
  scale_fill_manual(values = c(&quot;#619CFF&quot;, &quot;#F8766D&quot;)) +
  geom_boxplot(aes(fill = group),
               width = 0.1) + theme(aspect.ratio = 1)
</code></pre>

CC BY-SA 4.0
2022-09-19T21:50:19.270Z
2023-04-11T19:26:17.940Z
2023-04-11T19:26:17.940Z
Charles
<p>Using Seurat's VlnPlot, how can I remove the black outline around the violin plot?</p>
<p>For example, how can I change from the following graph with a (black) outline:</p>
<pre class="lang-r prettyprint-override"><code>    VlnPlot(ilc2,
        features = &quot;gene&quot;,
        split.by = &quot;group&quot;, 
        cols = c(&quot;#198BFD&quot;, &quot;#EC6464&quot;),
        pt.size = 0) +
  geom_boxplot(width = 0.1) + theme(aspect.ratio = 1)
</code></pre>
<p><a href="https://i.sstatic.net/wBszy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wBszy.png" alt="enter image description here" /></a></p>
<p>To a graph like the one below, which does not have an outline around the violin plot:</p>
<p><a href="https://i.sstatic.net/va4ps.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/va4ps.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2023-09-08T22:58:52.573Z
Please consider "accepting" your answer and upvoting the other helpful answer here.
M__
<seurat><ggplot2>
How to remove black outline from Seurat's VlnPlot violin plot
# How to remove black outline from Seurat's VlnPlot violin plot

(Asked by: username_0 on 2022-08-26)

Using Seurat's VlnPlot, how can I remove the black outline around the violin plot?
For example, how can I change from the following graph with a (black) outline:
    VlnPlot(ilc2,
        features = "gene",
        split.by = "group", 
        cols = c("#198BFD", "#EC6464"),
        pt.size = 0) +
  geom_boxplot(width = 0.1) + theme(aspect.ratio = 1)


To a graph like the one below, which does not have an outline around the violin plot:

**Tags:** seurat, ggplot2
> **Comments:**
> **username_1**: Please consider "accepting" your answer and upvoting the other helpful answer here.  

---

## 2 answers

### Answer by username_2 on 2023-04-11. Score: 2

wish there was a more subtle answer, but this works.  Place this previous to your VlnPlot
update_geom_defaults("violin", aes(linewidth = 0))


---

### Answer by username_0 on 2022-09-19. Score: 1

vln_df = data.frame(gene = ilc2_bs[["RNA"]]@data[ "gene", ],
                    group = ilc2$group)

ggplot(vln_df, aes(x = group, 
                   y = gene, fill = group)) + 
  geom_violin(aes(fill = group, 
                  color = gene),
              color = NA) +
  scale_fill_manual(values = c("#619CFF", "#F8766D")) +
  geom_boxplot(aes(fill = group),
               width = 0.1) + theme(aspect.ratio = 1)


---

