top5 = pbmc.markers %>% group_by(cluster) %>% top_n(n = 5, wt = avg_log2FC) g = unique(top5$gene) 默认参数绘图及调整美化 如果直接使用默认参数,不调节参数展示的情况 DotPlot(pbmc, features = g) 可以看到横坐标中features展示列全部挤在了一起,不便于阅读
AI代码解释 ggplot(data.final,aes(x=features.plot,y=id))+geom_point(aes(size=`Percent expressed`,color=`Average expression`))+theme_bw()+theme(panel.grid=element_blank(),axis.text.x=element_text(angle=90,hjust=1,vjust=0.5))+scale_color_gradient(low="lightgrey",high="blue")+labs(x=N...
vln.dat=FetchData(sce2,c(top_marker$gene,"celltype","seurat_clusters"))vln.dat$Cell<-rownames(vln.dat)#宽转长 vln.dat.melt<-reshape2::melt(vln.dat,id.vars=c("Cell","seurat_clusters"),measure.vars=top_marker$gene,variable.name="gene",value.name="Expr")%>%group_by(seurat_cluster...
Dot plot with multiple groups # Change dot plot colors by groups ggplot(ToothGrowth, aes(x=dose, y=len, fill=supp)) + geom_dotplot(binaxis='y', stackdir='center') # Change the position : interval between dot plot of the same group p<-ggplot(ToothGrowth, aes(x=dose, y=len, ...
df2<- df %>%group_by(dose)%>%summarise(sd = sd(len),len = mean(len))head(df2)构建图层 f <-ggplot(df2, aes(x = dose,y = len,ymin = len-sd,ymax = len+sd))有不同种类的bar Cross bar f + geom_crossbar()# 颜色分组f + geom_crossbar(aes(color = dose))# 手动设置颜色f ...
geom_dotplot( mapping = NULL, data = NULL, position = "identity", ..., binwidth = NULL, binaxis = "x", method = "dotdensity", binpositions = "bygroup", stackdir = "up", stackratio = 1, dotsize = 1, stackgroups = FALSE, origin = NULL, right = TRUE, width = 0.9, drop...
Change density plot colors by groups Calculate the mean of each group : Change line colors Change fill colors Change the legend position Combine histogram and density plots Use facets Functions:geom_density(),stat_density() Histogram plots
因为他用到了一个dot_plot()函数,没有找到这个函数是怎么来的。既然已经拿到了数据,就用ggplot2自己来画吧 读入数据 data.final<-read.csv("NM/figure2f.csv",header=T) head(data.final) 基本的散点图 ggplot(data.final,aes(x=features.plot,y=id))+ geom_point() 用Average expression映射颜色,用...
poneway<-ggerrorplot(oneway,x="group",y="min",desc_stat="mean_sd", add=c("violin","dotplot"),color="group",palette="jama", xlab="",ylab="时间(分)")+ theme(legend.position="none")+ theme(text=element_text(size=15))+ ...
2.3 发散点图(Diverging Dot Plot) 2.4 面积图(Area Chart) 3. 排名(Ranking) 3.1 有序条形图 3.2 棒棒糖图(Lollipop Chart) 3.3 点图(Dot Plot) 3.4 坡度图(Slope Chart) ...