color specific genes in VariableFeaturePlot
1
0
Entering edit mode
21 days ago
Assa Yeroslaviz ★ 1.9k

I was wondering if it is possible to color specific genes in a VariableFeaturePlot from the Seurat package.

I have a vector of names i use to label them, but I would like to also add a different color to a second vector of genes.

This how I label them for now:

plot1 <-  VariableFeaturePlot(C7_G7) +
  scale_color_manual(values = c("purple", "lightblue", "red")) 

genes <- c("Gzma", "Ighg1", head(VariableFeatures(C7_G7), 10))
plot2 <- LabelPoints(plot = plot1, points = genes, repel = TRUE, 
                     max.overlaps = Inf, xnudge = 0, ynudge = 0)

But how can I color specific points in the plot?

thanks

ggplot2 VariableFeaturePlot Seurat • 207 views
ADD COMMENT
3
Entering edit mode
21 days ago
plot1 <-  VariableFeaturePlot(C7_G7)

genes_colors <- c("Gzma"="orange", "Ighg1"="red") #Add more genes and colors
plot1$data[names(genes_colors),]$colors <- names(genes_colors) #Replace the no/yes with your gene names

plot2 <- plot1 + scale_color_manual(values=c("no"="purple", "yes"="lightblue", genes_colors))

plot3 <- LabelPoints(plot = plot2, points = names(genes_colors), repel = TRUE, max.overlaps = Inf, xnudge = 0, ynudge = 0)
ADD COMMENT

Login before adding your answer.

Traffic: 5929 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6