美文网首页
R: stair ggplot

R: stair ggplot

作者: 胡童远 | 来源:发表于2022-11-01 17:16 被阅读0次
library(plotly)
library(ggplot2)

d=data.frame(x=c(1,2,4,5,7,8,9), y=c(1,2,3,5,6,7,9))

ggplot(data=d, mapping=aes(x=x, y=y)) +
geom_step(direction="h")+
geom_point(color="red") 

X轴必须是数值,因子报错
geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?
ggplot(pan, aes(x=sort, y=samples_pan/1000000)) +
geom_step() +
geom_step(direction="h")+
geom_point(aes(color=Layer))+ 
labs(x="",y="Number of pan-genome (M)") +
theme_classic() +
theme(axis.text.x = element_text(angle=60,hjust=1,size=5))

参考
Stair Plots in ggplot2

相关文章

网友评论

      本文标题:R: stair ggplot

      本文链接:https://www.haomeiwen.com/subject/imvjtdtx.html