library('ggplot2') #data = commandArgs(trailingOnly=TRUE)[1] #merra <- read.table(url(data), sep=";", header=F, skip=24, colClasses = c("POSIXct", "character", "numeric", "numeric", rep("NULL", 6))) merra = read.csv(file="london2.csv", header=TRUE, sep=",") merra = merra[merra$GHI!=0,] #colnames(merra) = cbind('date','time','temp','RH') #merra$temp = merra[, 3] - 273.15 #merra$SH = (0.622/((101325/(((merra$RH/100)*(10^(((0.7859+0.03477*merra$temp)/(1+0.00412*merra$temp))+2))))))) #merra$H = (1.007*merra$temp-0.026)+(merra$SH*(2502-0.538*merra$temp)) #merra$dateTime <- paste(merra$date,merra$hour) merra$dateTime = as.POSIXlt(merra$timestamp,format="%Y-%m-%d %H:%M:%S") merra = subset(merra, format(as.Date(dateTime),"%Y")==2010) pdf("/home/harry/www/output/merra.pdf") ggplot(merra, aes(x=temp, y = SH, color=H)) + geom_point() 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), plot.margin=unit(c(1,1,1.5,1.2),"cm") dev.off() pdf("/home/harry/www/output/solar.pdf", width=10, height=5) ggplot(merra, aes(x=GHI)) + geom_density()+ scale_x_continuous(limits=c(0,1340)) dev.off()