[Dplr-commits] r754 - pkg/dplR/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Mar 31 15:36:43 CEST 2014
Author: mvkorpel
Date: 2014-03-31 15:36:42 +0200 (Mon, 31 Mar 2014)
New Revision: 754
Modified:
pkg/dplR/R/crn.plot.R
Log:
* Arguably cleaner way to define function aliases
* (Automatic removal of trailing spaces performed by text editor)
Modified: pkg/dplR/R/crn.plot.R
===================================================================
--- pkg/dplR/R/crn.plot.R 2014-03-31 12:56:11 UTC (rev 753)
+++ pkg/dplR/R/crn.plot.R 2014-03-31 13:36:42 UTC (rev 754)
@@ -1,46 +1,19 @@
-`chron.plot` <- function(crn, add.spline=FALSE, nyrs=NULL, f=0.5,
- crn.line.col='grey50',spline.line.col='red',
- samp.depth.col='grey90',
- samp.depth.border.col='grey80',
- crn.lwd=1,spline.lwd=1.5,
- abline.pos=1,abline.col='black',
- abline.lty=1,abline.lwd=1,
- xlab='Year',ylab='RWI'){
- args <- list()
- args[["crn"]] <- crn
- args[["add.spline"]] <- add.spline
- args[["nyrs"]] <- nyrs
- args[["f"]] <- f
- args[["crn.line.col"]] <- crn.line.col
- args[["spline.line.col"]] <- spline.line.col
- args[["samp.depth.col"]] <- samp.depth.col
- args[["samp.depth.border.col"]] <- samp.depth.border.col
- args[["crn.lwd"]] <- crn.lwd
- args[["spline.lwd"]] <- spline.lwd
- args[["abline.pos"]] <- abline.pos
- args[["abline.col"]] <- abline.col
- args[["abline.lty"]] <- abline.lty
- args[["abline.lwd"]] <- abline.lwd
- args[["xlab"]] <- xlab
- args[["ylab"]] <- ylab
- do.call(crn.plot, args)
-}
-
-`crn.plot` <- function(crn, add.spline=FALSE, nyrs=NULL, f=0.5,
- crn.line.col='grey50',spline.line.col='red',
- samp.depth.col='grey90',
- samp.depth.border.col='grey80',
- crn.lwd=1,spline.lwd=1.5,
- abline.pos=1,abline.col='black',
- abline.lty=1,abline.lwd=1,
- xlab='Year',ylab='RWI'){
+`chron.plot` <- `crn.plot` <- function(crn, add.spline=FALSE, nyrs=NULL, f=0.5,
+ crn.line.col='grey50',
+ spline.line.col='red',
+ samp.depth.col='grey90',
+ samp.depth.border.col='grey80',
+ crn.lwd=1, spline.lwd=1.5,
+ abline.pos=1, abline.col='black',
+ abline.lty=1, abline.lwd=1,
+ xlab='Year', ylab='RWI') {
if(!is.data.frame(crn)) stop("'crn' must be a data.frame")
-
+
op <- par(no.readonly=TRUE) # Save par
on.exit(par(op)) # Reset par on exit
- par(mar=c(3, 3, 3, 3), mgp=c(1.1, 0.1, 0),
+ par(mar=c(3, 3, 3, 3), mgp=c(1.1, 0.1, 0),
tcl=0.5, xaxs='i')
-
+
yr.vec <- as.numeric(row.names(crn))
crn.names <- names(crn)
nCrn <- ncol(crn)
@@ -68,7 +41,7 @@
yy <- c(samp.depth, 0, 0)
polygon(xx,yy,col=samp.depth.col,border=samp.depth.border.col)
axis(4, at=pretty(samp.depth))
- mtext(text.samp, side=4, line=1.25)
+ mtext(text.samp, side=4, line=1.25)
}
par(new=TRUE)
plot(yr.vec, spl, type="n",axes=FALSE,xlab='',ylab='')
More information about the Dplr-commits
mailing list