[R] Plot Lines instead of colour bands in R

Zilefac Elvis zilefacelvis at yahoo.com
Mon Sep 1 21:29:54 CEST 2014


Hi,
I have a plotting issue which I am trying to resolve in R. Please load my attached sample data (I used dput(lapply(sim.summary,head,1)) but the data are too large) to R, install "Rglimclim" package and run this code which shows an example plot I would like to change. My main function, "myplot" is found in the attached R object:
#------------------------------------------------------------------------------------------------------------------------------
require(Rglimclim) #http://www.ucl.ac.uk/~ucakarc/work/rain_glm.html 
myplot(sim.summary,plot.titles="",which.stats="Mean",quantiles=c(0,0.025,0.5,0.975,1), 
imputation=obs.summary,which.sites=NULL,which.timescales="daily",colours.sim=c("magenta","darkorchid1","deeppink3","yellow"), 
cex.lab=1.4,cex.axis=1.5,ylabs="Precipitation (mm)") 
mtext(text=expression(paste(italic(Mean[C]))),font=3, side=3, line=1, cex=1.3, col="black")
#-------------------------------------------------------------------------------------------------------------------------------

I would like to remove the colours completely (EXCEPT THE BOLD BLACK COLOUR BAND) and replace them with line types in R. That is, I want to specify various inbuilt R line types/line colours/line width for quantiles=c(0,0.025,0.5,0.975,1). The colours can be removed by setting colours in colours.sim=c("magenta","darkorchid1","deeppink3","yellow") to "white".

Practically, I would like my final code after modifying "myplot" function to look like:

#---------------------------------------------------------------------------------------------------------
myplot(sim.summary,plot.titles="",which.stats="Mean",quantiles=c(0,0.025,0.5,0.975,1), 
     imputation=obs.summary,which.sites=NULL,which.timescales="daily",plot.type=c("l","l","l","l","l"),
line.type=c(2,3,4,5,6),linecol.type=c('green4','red','blue','darkorchid1','deeppink3'), 
     line.width=c(2,2,2,2,2), cex.lab=1.4,cex.axis=1.5,ylabs="Precipitation (mm)") 
mtext(text=expression(paste(italic(Mean[C]))),font=3, side=3, line=1, cex=1.3, col="black") 
#---------------------------------------------------------------------------------------------------------

I have 20 such graphs to develop.
Thanks for any inputs. 
AT.


More information about the R-help mailing list