control border thickness of Stacked_VlnPlot
Hi @samuel-marsh! Thanks for this useful package.
Is there anyway to change the border thickness of Stacked_VlnPlot? When I save it with ggsave and arrange it into a figure it looks incredibly thick:

Thanks in advance for looking into this !
Hi @massonix
Thanks so much!! You’re just in time of me trying to squash bunch of bugs for next master release. I’ll look into this. In your experience does number of stacks (features) and/or groups (idents) effect line thickness? How about size of output when using ggsave?
Thanks, Sam
I cannot say much about the number of stacks or groups because it's the first time I use it :)
In terms of ggsave, yes, if I increase the width then it's less thick. However, I need to narrow it because I have limited space in the figure I'm creating.
Thanks Sam!
got it! I'll take look and see what I can find!
@massonix been looking into couple things but also just wanted to get some more info on your figure assembly process. After saving the vlnplot in this case what packages/how are you assembling things into figures? Trying to think if maybe there is secondary method to fix the issue in addition to possible primary solution.
Hey Sam,
Sorry for the delayed response, I was on vacation. That's the code I'm using:
vln1 <- Stacked_VlnPlot(
seurat_object = seurat_rna,
features = goi_rna[1:(floor(length(goi_rna) / 2))],
x_lab_rotate = TRUE,
colors_use = colors_rna,
plot_spacing = 0.05
) &
theme(
axis.text.x = element_blank(),
axis.title.y = element_text(size = 6),
axis.text.y = element_text(size = 5))
vln2 <- Stacked_VlnPlot(
seurat_object = seurat_rna,
features = goi_rna[((floor(length(goi_rna) / 2)) + 1):length(goi_rna)],
x_lab_rotate = TRUE,
colors_use = colors_rna,
plot_spacing = 0.05
) &
theme(
axis.text.x = element_blank(),
axis.title.y = element_text(size = 6),
axis.text.y = element_text(size = 5))
vlns <- vln1 | vln2
ggsave(
filename = glue("{path_to_wd}/results/paper/figures/figure_3_cytotoxic_vln_markers.pdf"),
plot = vlns,
height = 15,
width = 11.5,
units = "cm"
)
Later, I import it to inkscape and I merge it with other panels, add labels etc.
Hope that helps! Thanks again for looking into it
Ramon
I think this might be what we are looking for!! Will check it out and if so then when it gets pushed to full ggplot release I will update function.
https://twitter.com/thomasp85/status/1536996957616492549?s=20&t=1_ItFXaGT14A3YfpOFLzSg
Nice! Thanks Sam :)
ok just popping back in to say that this is still coming. Working on dev branch of ggplot2 (Hadley Wickham posted recently its targeted for end of Oct release) and I can start to get things closer and hope to have fully complete solution sometime soon. Right
now having to hack linewidth param manually into the patchwork and also need to do it iteratively over all the features. But here is proof of principle:

Will work on integrated solution to change all linewidths within the plot. But for now happy that can control the geom_violin thickness finally.
Hi @massonix
Ok sorry again for such a long wait on this but fix is now live in dev branch (v1.0.2.9020). There is new parameter called vln_linewidth which takes numeric input and adjusts the outline line thickness of the violins thanks to new ggplot2 updates and linewidth parameter.
The axis lines can then also be easily modified using standard ggplot2/patchwork notation and new linewidth param as well so I've left that to end user because it's straightforward.
p1 <- Stacked_VlnPlot(pbmc, c("FOS", "CD4", "CD8A"))
p1 & theme(axis.line=element_line(linewidth=2))
Hope this helps!! :) Best, Sam