junjunlab / ggSCvis

Visualizing SingleCell data Using GGplot2
Other
27 stars 2 forks source link

A question of ggscplot #4

Open Chen123456-stack opened 1 month ago

Chen123456-stack commented 1 month ago

ggscplot(object = pbmc) Error in geom_blank(): ! Problem while computing aesthetics. ℹ Error occurred in the 1st layer. Caused by error in FUN(): ! data must be uniquely named but has duplicate columns Run rlang::last_trace() to see where the error occurred.

error occurred when i use ggscplot, could you give me some advise?

junjunlab commented 1 month ago

Please supply detailed code or information.

Chen123456-stack commented 1 month ago

OK, thank you for your reply! I supply the detailed code as follow:

library(Seurat)
library(ggplot2)
library(ggscatter)
library(ggSCvis)

Load Seurat object

pbmc <- readRDS("./2.after_celltype_anno.rds")

p2 <- ggscplot(object = pbmc) +
geom_scPoint(aes(color = cell_type, cluster = cell_type),
show.legend = FALSE,
label.gp = gpar(fontsize = 8, fontface = "bold.italic")) +
facet_wrap(~group, ncol = 3) +
theme_bw() +
theme(panel.grid = element_blank(),
axis.ticks = element_blank(),
strip.background = element_blank(),
strip.text = element_text(face = "bold.italic", size = rel(1)),
axis.text = element_blank()) +
xlab("")

pbmc was a seurat V5 object I want to draw a single cell density map using the above code, but the above error occurs

junjunlab commented 1 month ago

Please upload your test data, let me have a try.