library(ggplot2) library(grid) library(gridExtra) library(comf) weather = "GBR_London.Gatwick.037760_IWEC.epw" epw = read.csv(weather, skip=9) colnames(epw) = cbind('year','month','day','hour','minute','dataSource','dryBulb','dewPoint','relHum','atmosPressure','exthorrad','extdirrad','horirsky','glohorrad','dirnorrad','difhorrad','glohorillum','dirnorillum','difhorillum','zenlum','winddir','windspd','totskycvr','opaqskycvr','visibility','ceiling_hgt','presweathobs','presweathcodes','precip_wtr','aerosol_opt_depth','snowdepth','days_last_snow','col1','col2','col3') epw$dataTime = as.POSIXlt(paste(epw$month,epw$day,epw$hour),format="%m %d %H") epw$doy=as.numeric(strftime(epw$dataTime, format = "%j")) for (i in c(1,2,3,4,5,6)) { epw$tsix=epw[epw$doy == i, ]$dryBulb[6] } # if (tsix < -5){ # clo = 1.0 # } else { # if(tsix>-55 && tsix<5){ # clo = 0.818-(0.0364*tsix) # } else { # if(tsix>5 && tsix<26){ # clo = 10^(-0.1635-(0.0066*tsix)) # } else { # # clo =0.46 # } # } # } #epw$tsix= #epw$clo= epw$PMV=calcPMV(epw$dryBulb, epw$dryBulb, 0.3, epw$relHum, 2.0, 1.0) pdf("/home/martin/vault/www/output/test.pdf",width = 10, height = 5) ggplot() + geom_point(data=epw,aes(x=relHum,y = dryBulb,colour = PMV))+ scale_color_gradient2(midpoint=0, low="blue", mid="white",high="red", space ="Lab" ) #geom_line(data=temps[temps$month == i, ],aes(x=hour,y = dryBulb_max)) + #geom_line(data=temps[temps$month == i, ],aes(x=hour,y = dryBulb_min)) + #scale_y_continuous(limits = c(-10, 40),breaks=seq(from = -10, to = 40, by = 5),expand = c(0, 0)) + #scale_x_continuous(breaks=c(0,6,12,18,24),expand = c(0, 0))+ #geom_hline(yintercept=comftemp)+ #geom_ribbon(data=temps,aes(ymin=18,ymax=22,x=hour,alpha=0.3,fill='blue'))+ #geom_ribbon(data=temps,aes(ymin=22,ymax=24,x=hour,alpha=0.3,fill='red'))+ #theme( # panel.background = element_rect(fill = 'white'), # panel.border = element_rect(colour = "black", fill=NA, size=1), # panel.grid.major = element_line(colour = "#B0B0B0"), # panel.grid.minor.x = element_blank(), # panel.grid.minor.y = element_blank())+ # ggtitle(format(ISOdate(2000, i, 1), "%B")) + # labs(x='Date', y= expression("Temperature (" *degree * "C)")) # axis.title.x = element_text(vjust=-3,size=10), # axis.title.y = element_text(vjust=+3,size=10), # panel.border = element_rect(fill=NA,colour = "#AAAAAA",size=2), ##ii plot.margin=unit(c(1,1,1.5,1.2),"cm") dev.off()