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")
![](https://img.haomeiwen.com/i23233571/67d04fb5c17771d6.png)
sunspotyear<-data.frame( Year =as.numeric(time(sunspot.year)), sunspots=as.numeric(sunspot.year) ) ggplot(sunspotyear,aes(x=Year,y=sunspots))+geom_area()
将数据集转化为数据框
![](https://img.haomeiwen.com/i23233571/8d122a06f94853b7.png)
ggplot(sunspotyear,aes(x=Year,y=sunspots))+geom_area(colour="black",fill="blue",alpha=0.2)#alpha=0.2将透明度调成80%
![](https://img.haomeiwen.com/i23233571/ed6ff44df9c20fd3.png)
ggplot(uspopage,aes(x=Year,y=Thousands,fill=AgeGroup))+geom_area()
![](https://img.haomeiwen.com/i23233571/3fb18a346ffa41f7.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函数增加了细线
![](https://img.haomeiwen.com/i23233571/136c0d03ba99145f.png)
网友评论