color specific genes in VariableFeaturePlot
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
• 839 views
•
link
1 answer
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)
• 0 views
•
link
Log in to answer this question.