[R] Line over Boxplot

gfishel gfishel at wral.com
Thu Sep 20 15:41:20 CEST 2012


Very much a rookie at R, and have only recently started using it again so
pardon the simple question. I am trying to produce a box plot from one data
set and then overlay a line plot from another data set. The box plot data
set is made up of 20 sets of 30 data points, or 600 total data points. The
line has only 30 total data points. The box plot is plotting fine, but for
some reason, the line plot is starting at the 6th data position and running
off the screen. I tried modifying the text file so that the data repeated it
self 30 times to make the total number of lines in the file identical, but
that did not help! Here are my two datasets.....

temp.final.text
<http://r.789695.n4.nabble.com/file/n4643736/temp.final.text>  
tmax.final.text
<http://r.789695.n4.nabble.com/file/n4643736/tmax.final.text>  

And here is my script....

R   --save --no-save --vanilla  <<  EOF

pdf(file="boxplot_tmax_$YYYY$MM$DD${HH}.pdf", height=10, width=12)

soton.df = read.table ("tmax.final.text", header=TRUE)
gfs.df = read.table ("greg.txt", header=TRUE)
boxplot (TMAX ~ HOUR, data=soton.df, xlab="Forecast Hour", ylab="MAX TEMP",
main="GEFS $YYYY$MM$DD ${HH}Z FORECAST MAX TEMPS", whiskcol="red",
col="red", outline=TRUE, ylim=c(0,100),xlim=c(1,30),xaxs="i",yaxs="i")
lines (data=gfs.df, type="o", col="green")
par(new=TRUE)
abline(h=seq(0,100,by=5),lty=2)
abline(v=seq(1,30,by=1),lty=2)



EOF

Thanks for  helping me out!




--
View this message in context: http://r.789695.n4.nabble.com/Line-over-Boxplot-tp4643736.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list