Closed giovanegt closed 4 years ago
We would need to plot two average expression bars (to reflect multiple color scales required by split.by). unfortunately this is not (to our knowledge) supported by ggplot, so we chose to remove the bar entirely. If someone has a workaround, please feel free to suggest one here
i found a way to solve this problem hope it works in your project as well, i use seurat v3 and R v.3.5 and its a part of the single cell experiment.
i have 8 different samples and four by four they are replicates , means 2 subgroup. in these samples after identifying cell types and gene markers , i wanted to add some interesting genes to the dotplot based on the sample and cell type, in the normal way you have to use two color bar to show the subgroups , by using split.by. but the trick that i used is to add the subgroup of the samples and cell types to the idents(assay) i shared my code and plot here :
new.idents <- seurat@meta.data$cell_type_singler
Idents(object = seurat) <- new.idents #add cell type as idents
seurat$celltype.sample_WT_P21<- paste(Idents(seurat),seurat$sampleNOrep_WT_P21, sep = "_") #add sample subgruops to the cell type idents
new.idents <- seurat@meta.data$celltype.sample_WT_P21
Idents(object = seurat) <- new.idents # now just add it to the seurat object as new idents
dotplot_interested_cells_vs_intreseted_genes=DotPlot(seurat, cols = c("red"), dot.scale = 8, features =c("H2-K1","H2-Q1","Cd74","Crisp3","Rps18","H2-Q5")) + RotatedAxis() + theme(axis.text = element_text(size = 14))+scale_colour_gradient(low =c("white"), high =c("red")) +
guides(color = guide_colorbar(title = 'Average Expression'))
Great work around! I will try it as soon as I get back to the lab.
Appreciate the help!
So, Now, Is this problem solved?
Yes, solved as I explained Sent from my Samsung Galaxy smartphone. -------- Original message --------From: jeffery notifications@github.com Date: 7/23/20 17:05 (GMT+01:00) To: satijalab/seurat seurat@noreply.github.com Cc: iman nazari nazariiman38@gmail.com, Comment comment@noreply.github.com Subject: Re: [satijalab/seurat] Average expression bar had disappeared in DotPlot (#2487) So, Now, Is this problem solved?
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.
I would like to mention here that your solution doesn't allow for the organization on the y-axis in a 'paired' manner, where similar clusters, yet from two (or more) independent experiments/conditions are paired together.
Also new.idents <- seurat@meta.data$celltype.sample_WT_P21
is redundant. Just performIdents(object = seurat) <- "celltype.sample_WT_P21"
I pair the y-axis manually by re-leveling the metadata (very manual), is there anyone who has a simpler solution? There has to be a way to extract metadata and use something like facet_wrap(~condition)
.
@Dragonmasterx87 you can reorder the idents to the the order you want them to appear like this: seurat@active.ident <- factor(seurat@active.ident, levels=c("a", "b", "c", "d"))
seurat@active.ident <- factor(seurat@active.ident, levels=c("a", "b", "c", "d"))
@yahayayabo Thanks! Been a long time haha figured out how to make complex dotplots since then! Also this was my manual method....I would just re-order the metadata as when you change active.idents
your custom alignment will not be saved 😅
Hi all, I have two different samples (ctrl and yn1). I am trying to plot a Dotplot to show the changes in the expression levels of a given number of genes across the different clusters. For some reason, the average expression bar disappeared when picked colors (red and green) to plot the graph. how do I bring it back? the only bar showing is the Percent expressed, I do not know how to bring back the average expression bar.
I thank you all in advance
DotPlot(Merged.big, split.by = "yn1", cols = c("red3", "green3"), dot.scale = 15, features = rev(c("gene1","gene2", ...))) + RotatedAxis() + theme(axis.text = element_text(size = 20, face = "bold"))