Hello,
I really appreciate your efforts to make such useful tool for single cell RNA seq.
I've been using v2 for the whole time and now adjusting to v3.
I've found that DoHeatmap function has changed a bit. Previously, we were able to set colors manually through col.low ~col .high, but I've found it's missing in v3. Is it deprecated?
If so, how can I set colors manually for DoHeatmap function?
Hi,
Since DoHeatmap returns a ggplot object in Seurat v3, you can manipulate the colors by specifying the color scale. For example
library(ggplot2)
DoHeatmap(object = pbmc_small) + scale_fill_gradientn(colors = c("blue", "white", "red"))
You can also easily apply color schemes provided by other packages, such the viridis color palettes.
library(viridis)
DoHeatmap(object = pbmc_small) + scale_fill_viridis()
Hi, I think it's currently not possible to change the color of group bar, right?
DoHeatmap(object = pbmc_small) + scale_color_manual(values=cbPalette)
No, unfortunately it's not currently possible to change those colors though we would welcome a PR for that feature if anyone's interested in implementing.
Single a google search defaults to this I thought i'd add this in case someone would be interested
group.colors = c("red", "blue") adds colors to the bar.
Does anyone know if you can sort the groups (columns) in the heatmap specifically in doheatmap?
@lwhitmore You can do this by changing the order of levels of the variable that you want to sort by.
levels(factor(object@variable_to_sort))
> levels: 1,2,3
object@variable_to_sort <- factor(object@variable_to_sort, levels=c(3,2,1))
levels(object@variable_to_sort)
> levels: 3,2,1
Follow the @andrewwbutler idea , we can do the following
mapal <- colorRampPalette(RColorBrewer::brewer.pal(11,"RdBu"))(256)
DoHeatmap(pbmc_small,
angle = 90,size = 3)+
scale_fill_gradientn(colours = rev(mapal))
Most helpful comment
Hi,
Since
DoHeatmapreturns a ggplot object in Seurat v3, you can manipulate the colors by specifying the color scale. For exampleYou can also easily apply color schemes provided by other packages, such the viridis color palettes.