Entering edit mode
3.3 years ago
Maria17
▴
40
Hi All,
I'm working on single-cell RNA seq data with the Seurat package.i want to make a barplot with cluster in x-axis and percentage of cell type on the y-axis. i applied dittoseq package and this is my code :
dittoBarPlot(
object = s.integrated,
var = "cell.type",
group.by = "seurat_clusters",color.panel = col_vector_samples)
in the output picture, my cluster numbers aren't sorted, I tried to sort them but it just sorted the numbers, not the bar (data) itself.
Any recommendations or solutions would be appreciated.
Thanks.
Maria
Hello, i merged 6 samples and seurat clusters are in x-axis from 0 to 22 and patient ID is in legend part.i want to show the percentage of each patient in each cluster in barplot . now my x-axis is 0,1,10,11,15,.... . i want to be 0,1,2,3,.... . i reorder the axis but just labels reordered not the data(bars) . i run your code but my x-axis doesnt change.
It's a bit difficult to imagine what's going on. Can you perhaps supply the code that you use to generate the image that's sorted and what the output looks like?
Yes. code :
dittoBarPlot(Seurat.integrated, "PatientID", group.by = "seurat_clusters", scale = "percent",color.panel = cols)
x axis is seurat clusters by each patients. i want to sort the cluster numbers . instead of 0,1,10 > shows 0,1,2,3,.... thanks.
what happens when you follow ATpoint's code and use the
x.reorder
parameter, e.g. followingcolor.panel = cols
?when I add x.reorder = c(0:22) it converts number 9 ( last number ) to NA and doesn't change anything else. when I delete x.reorder again shows all clusters but not in order(same as figure) I checked the levels of my clusters is 0:22.
for the record, I think with dittoSeq you probably would have had to look at the order that it uses to determine the "levels" and then indicate those in the order that you want, i.e.:
c(1,2,13,17,18,19,20,21...)
and so on.Did you try
dittoSeq
after you changed the seurat clusters to factors? That should have worked, too, especially, if you indicatedfactor(...., ordered = TRUE)
.I found the solution in case if someone needs it :
with dittoseq i could not change the order of my x-axis , i don't know why so i used ggplot :
factor(Seurat.object@meta.data$seurat_clusters, levels=c(seq(0,22)))
Good luck.