Dear R users,
As per my attached script I am ploting monthly mean data which has missing
months.
But in the plot missing months are not shown (plot attached).
Kindly help how to show complete plot (Jan-Dec) with missing months.
Regards,
Yogesh
file<-read.csv("CRI-run109-run110.csv")
names(file)
attach(file)
>time_span <- file[(file$yr==1993),]
>#time_span
> sub_mo <- (time_span$mo)
> sub_mo
[1] 2 2 2 2 4 4 4 4 6 6 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10
[26] 10 10 10 10 10 11 11 11 12 12 12
>sub_co2obs <- (time_span$co2obs)
>#sub_co2obs
>sub_co2tm3 <- (time_span$co2tm3)
>#sub_co2tm3
> co2obs.month.mean <- tapply(sub_co2obs,sub_mo,mean)
> co2obs.month.mean
2 4 6 7 8 9 10 11
359.1275 363.2485 358.8825 357.0652 356.7705 356.4452 351.1836 350.2767
12
354.8807
>
> co2tm3.month.mean <- tapply(sub_co2tm3,sub_mo,mean)
> co2tm3.month.mean
2 4 6 7 8 9 10 11
358.4755 360.6863 358.6957 356.7071 356.2717 355.9365 354.4344 355.7239
12
357.4928
>
>plot(co2obs.month.mean,
>ylim=c(350,364),xlab=NA,ylab=NA,col="red",xaxs="i",yaxs="i",type="o", axes=F)
>axis(1,at=1:12,labels=c("J","F","M","A","M","J","J","A","S","O","N","D"))
>axis(2)
>axis(3,at=1:12,labels=c("J","F","M","A","M","J","J","A","S","O","N","D"))
>axis(4, at=NULL, labels=FALSE)
>grid(lty="dashed",col="grey")
>points(co2tm3.month.mean,type="o",col="blue")
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.