sqjin / CellChat

R toolkit for inference, visualization and analysis of cell-cell communication from single-cell data
GNU General Public License v3.0
621 stars 142 forks source link

Multiple datasets - Comparing overall information flow #536

Open sky5198 opened 1 year ago

sky5198 commented 1 year ago

Hello, I have been utilizing CellChat greatly to explore various datasets. Right now, I am using it to compare three different datasets. When I make previous figures, I can tell that all three of my datasets are there. When I go to make the bar chart for the overall information flow, I can only successfully perform the code by looking at two datasets, not all three. Is it possible to make this graph with more than two? I have copied my code, the error, and the corresponding image below.

Thank you!

Compare the overall information flow of each signaling pathway

cellchat.merged contains three datasets not two.

gg1 <- rankNet(cellchat.merged, mode = "comparison", stacked = T, do.stat = TRUE, comparison = c(1,2,3)) gg2 <- rankNet(cellchat.merged, mode = "comparison", stacked = F, do.stat = TRUE, comparison = c(1,2,3)) gg1 + gg2

ERROR: The text on the y-axis will not be colored for the number of compared datasets larger than 3! image

sky5198 commented 1 year ago

I solved it! Thank you!!

chen-zhan commented 1 year ago

我解决了!谢谢!!

Hi, could you teach how to solve this problem

sky5198 commented 1 year ago

Hello, this is how I solved the problem. My cellchat.merged object has three datasets in it.

Compare the overall information flow of each signaling pathway

color.3 <- c("royalblue","orange1","springgreen4") #need to specify three colors gg1 <- rankNet(cellchat.merged,comparison = c(1,2,3),color.use = color.3, mode = "comparison", stacked = T, do.stat = TRUE) gg1

I hope this helps!