VlnPlot(scobj, features = c("nFeature_RNA", "nCount_RNA"), ncol = 2)
Error in Ops.data.frame(guide_loc, panel_loc) :
‘==’ only defined for equally-sized data frames
Error in Ops.data.frame(guide_loc, panel_loc) : ‘==’ only defined for equally-sized data frames
解决办法:
首先,我是能够通过一下代码手动绘制小提琴图,所以确认是VlnPlot
函数内部的某些不一致性或 bug。
# 提取用于绘图的数据
plot_data <- scobj@meta.data[, "nFeature_RNA", drop = FALSE]
plot_data$ident <- scobj@active.ident
library(ggplot2)
# 手动绘制小提琴图
ggplot(plot_data, aes(x = ident, y = nFeature_RNA)) +
geom_violin() +
theme_minimal()
于是,我发现这位博主说可能是ggplot2版本不适配。于是我安装了最新版本的ggplot2,问题就解决了。https://blog.csdn.net/weixin_58270210/article/dethttps://blog.csdn.net/weixin_58270210/article/details/136589518https://blog.csdn.net/weixin_58270210/article/details/136589518https://blog.csdn.net/weixin_58270210/article/details/136589518ils/136589518