Ne绘图(折线图)

解决R报错( installation of package ‘lifecycle’ had non-zero exit status)
install.packages("ggplot2",type="binary")
library(ggplot2)
install.packages("lifecycle")
install.packages("lifecycle",type="binary")
install.packages("ellipsis",type="binary")
install.packages("pillar",type="binary")
Ne=read.csv("Ne.csv", sep=",", header=T, row.names=1)
View(Ne)
objects(Ne)
Ne$name=row.names(Ne)
install.packages("reshape")
library('reshape')
Ne1= melt (Ne, id='name')
View(Ne1)
objects(Ne1)
Ne1$name <- factor(Ne1$name,levels=c("13","15","17","20","23","27","32","38","45","54","66","80","98",
                                     "121","150","187","234","293","367","454","553","658","758","845","915",
                                     "959","984"))
ggplot(data = Ne1,aes(x = name, y = value, colour=variable,group=variable))+geom_line()+geom_point()+theme_bw()+
  theme(panel.grid=element_blank())+scale_y_continuous(expand = c(0,0),limits=c(0,5000))

ggplot(data = df, mapping = aes(x=year, y=value,
linetype=type, colour=type, shape=type, fill=type)) +
geom_line() +
geom_point() + #绘制线图和点图
scale_linetype_manual(values=c(1,2)) + #自定义线条类型
scale_color_manual(values=c('steelblue','darkred')) + #自定义颜色
scale_shape_manual(values=c(21,23)) + #自定义点形状
scale_fill_manual(values=c('red','black')) #自定义点的填充色

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容