R作图-----北京市2017年一季度AQI指数日历热图
##这里读入的数据为北京2007年第一季度的AQI数据 databjs1<-read.csv("F:/bjaqis1.csv",header=T) databjs1$日期<-as.Date(databjs1$日期)##将日期转换为函数包可识别的形式 names(databjs1)[1]<-"date" breaksbj<-c(0,50,100,150,200,300,500) #将AQI按污染程度划分 labelw<-c("优","良","轻度污染","中度污染","重度污染 ","严重污染") colsbj=c(brewer.pal(9,"YlGn")[6],brewer.pal(9,"YlGnBu")[3],openColours(scheme = "heat", n = 8)[4:7])#定义了自己喜欢的颜色 calendarPlot(databjs1,pollutant="AQI",year=2017,month=c(1:3),breaks=breaksbj,labels=labelw, cols =colsbj,main="北京市2017年一季度AQI指数")
- 这是今天的成果,需要载入的包是:
library(openair)
library(RColorBrewer)
- 参看?calendarPlot##获取更多函数calendarPlot细节
- 统计之都https://cosx.org/2012/05/calendarheatmap
- 这个公众号:http://mp.weixin.qq.com/s/1SPUN-NgQGKfGunYxYZ_zQ有相关文章