美文网首页
ggplot2 day3

ggplot2 day3

作者: Silmarillion123 | 来源:发表于2020-06-08 13:33 被阅读0次

ggplot(tg,aes(x=dose,y=length,color=supp))+geom_line(linetype="dashed")+geom_point(shape=22,size=3,fill="white")+scale_color_brewer(palette="Set1")

image.png

sunspotyear<-data.frame( Year =as.numeric(time(sunspot.year)), sunspots=as.numeric(sunspot.year) ) ggplot(sunspotyear,aes(x=Year,y=sunspots))+geom_area()
将数据集转化为数据框

image.png
ggplot(sunspotyear,aes(x=Year,y=sunspots))+geom_area(colour="black",fill="blue",alpha=0.2)#alpha=0.2将透明度调成80%
image.png
ggplot(uspopage,aes(x=Year,y=Thousands,fill=AgeGroup))+geom_area()
image.png
ggplot(uspopage,aes(x=Year,y=Thousands,fill=AgeGroup))+geom_area(colour="black",size=0.2,alpha=0.4)+scale_fill_brewer(palette="Blues",breaks=rev(levels(uspopage$AgeGroup)))#breaks函数可反转堆积顺序,colour函数和size函数增加了细线
image.png

相关文章

网友评论

      本文标题:ggplot2 day3

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