Message-ID: <644e1f321001191947w2a041375se034ecff445cd306@mail.gmail.com>
Date: 2010-01-20T03:47:55Z
From: jim holtman
Subject: Plot frame border to start at zero?
In-Reply-To: <4B565173.1070207@metstat.com>
plot(..., xaxs='i', yaxs='i')
On Tue, Jan 19, 2010 at 7:42 PM, Douglas M. Hultstrand
<dmhultst at metstat.com> wrote:
> Hello,
>
> I am creating plots of hourly precipitation and accumulated precipitation
> (on different axis, see attached image). I was wondering how can I have the
> plot frame (black border) start at zero, it looks like it is plotted less
> than zero?
> The code I use to create the png files is below:
>
> CairoPNG(PNG_file,width=1000, height=600, pointsize=14, bg="white")
> ? ? ? opar <- par(mai = c(.8, .8, 1, .8)) ? ?# Set margins
> ? ? ? plot(ppt,type="h",col="dark grey",ylim=c(0,max_ppt+1), lwd=6, xlab='',
> ylab='', main=title, frame.plot=T, axes=F)
> ? ? ? axis(2, col="black", las=2)
> ? ? ? par(new=T) # R to overwrite the first plot
> ? ? ? plot(accum, type="l", col="blue", axes=F, ylab='', xlab='', lwd=2)
> ? ? ? axis(1, col="black", las=1)
> ? ? ? axis(4, pretty(c(0, max_accum) ), col="black", las=2)
> ? ? ? legend("topleft", legend=c('Incremental', 'Accumulated'), ?col=c("dark
> grey", "blue"), lwd=c(6, 2.0))
> ? ? ? legend((length(n)-4),max_accum, legend=paste(round(max_accum,2)),
> bty="n", cex=.90) ? ? ### max accum location
> ? ? ? mtext(paste("Lat:", .lat, "Lon:", .lon), cex=0.95)
> ? ? ? mtext("Index Hour", side=1, line=2)
> ? ? ? mtext("Incremental Precipitation (in)", side=2, line=2.5)
> ? ? ? mtext("Accumulated Precipitation (in)", side=4, line=2)
> dev.off()
>
>
> Thanks for all your help,
> Doug
>
> ---------------------------------
> Douglas M. Hultstrand, MS
> Senior Hydrometeorologist
> Metstat, Inc. Windsor, Colorado
> voice: 970.686.1253
> email: dmhultst at metstat.com
> web: http://www.metstat.com
> ---------------------------------
>
>
> ______________________________________________
> R-help at r-project.org 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.
>
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?