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