enblacar / SCpubr

Generate high quality, publication ready visualizations for single cell transcriptomics data.
https://enblacar.github.io/SCpubr-book/
GNU General Public License v3.0
157 stars 12 forks source link

background of label in DimPlot #35

Closed laurie-tonon closed 1 year ago

laurie-tonon commented 1 year ago

Hi,

I would like to force the background of the box around the labels of my DimPlot to be white, instead of a contrasted color. I can find this option in the documentation. Do you have an idea how I could do that?

Thanks

enblacar commented 1 year ago

Hello @laurie-tonon

Thanks for using my package!

Apologies for the delay answering this, I am currently in a high workload peak in my PhD.

Right now this is not available in SCpubr via a parameter, but I will add it for the next update!

However, I don't want to leave you empty handed. Here is a hotfix to get the job done:

# Generate your DimPlot normally.
p <- SCpubr::do_DimPlot(sample, 
                        label = TRUE, 
                        repel = TRUE, 
                        legend.position = "none",
                        label.color = "black")

# Add a new mapping for the fill aesthetic that controls the labels.
p <- p + 
     ggplot2::scale_fill_manual(values = rep("white", 10)) 

p
# Note that you need to provide a vector of as many colors as idents.
# In this case, the same color X times.

Hope it helps! Enrique