ggplot2 day3

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

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