This is a test version of Biostars. For the public version, visit https://www.biostars.org.
dot plot split by issue

Hello everyone,

I am trying to make a graph, similar to the supplementary figure 2b in this file: https://static-content.springer.com/esm/art%3A10.1038%2Fs41467-020-17740-1/MediaObjects/41467_2020_17740_MOESM1_ESM.pdf.

I suppose my code should be like:

pdf(file='byconditiontop10.pdf',width=20) DotPlot(data, features =c("DCN", "COL1A2", "CFD", "KLRB1" ), split.by="condition")+ theme(axis.text.x = > > > element_text(angle = 90))

But I received following error:

Error in DotPlot(data, features = c("DCN", "COL1A2", : ge, Monocytes, Basal cell, Acinar, bcell, Not enough colors for the number of groups

I hope you guys could give me some advices how to deal with issue.

Best Andy

dotplot seurat r

How many conditions do you have? According to the following GitHub issue https://github.com/satijalab/seurat/issues/1414 if you have more than two groups defined in your split.by variable then you need to provide a vector of colors.

and the DotPlot documentation states

cols   Colors to plot: the name of a palette from RColorBrewer::brewer.pal.info, a pair of colors defining a gradient, or 3+ colors defining multiple gradients (if split.by is set)

I have 5 conditions. So I should add collar command? like >cols=c("lightgrey", "red")

pdf(file='bystudytop10.pdf',width=20) features <- c("DCN", "COL1A2", "CFD", "KLRB1", "CD7", "GZMK", "MT1G", "MT1H", "MT1F" ) DotPlot(data, features=features, split.by="study", col=c("#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#800080", "#FFA500", "#FFC0CB", "#00FFFF", "#A52A2A", "#000000"))+ theme(axis.text.x = element_text(angle = 90)) dev.off()

My study included 10 different studies, and I add the color command, but the system still saying there are some error with my code.

Error in DotPlot(data, features = features, split.by = "study", col = c("#FF0000", : argument 4 matches multiple formal arguments

I think I might should not add color like this?

It worked! Thank you so much!

0 answers

No answers yet.

Log in to answer this question.