2
$\begingroup$

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)

enter image description here

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

enter image description here

$\endgroup$
1
  • $\begingroup$ Please consider "accepting" your answer and upvoting the other helpful answer here. $\endgroup$
    – M__
    Sep 8, 2023 at 22:58

2 Answers 2

2
$\begingroup$

wish there was a more subtle answer, but this works. Place this previous to your VlnPlot

update_geom_defaults("violin", aes(linewidth = 0))
$\endgroup$
1
$\begingroup$
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)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.