[Returnanalytics-commits] r1917 - pkg/PerformanceAnalytics/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Apr 27 23:09:07 CEST 2012


Author: peter_carl
Date: 2012-04-27 23:09:07 +0200 (Fri, 27 Apr 2012)
New Revision: 1917

Modified:
   pkg/PerformanceAnalytics/R/chart.ECDF.R
   pkg/PerformanceAnalytics/R/chart.QQPlot.R
Log:
- added parameters for hiding x and y axes


Modified: pkg/PerformanceAnalytics/R/chart.ECDF.R
===================================================================
--- pkg/PerformanceAnalytics/R/chart.ECDF.R	2012-04-27 16:16:12 UTC (rev 1916)
+++ pkg/PerformanceAnalytics/R/chart.ECDF.R	2012-04-27 21:09:07 UTC (rev 1917)
@@ -14,12 +14,12 @@
 #' @param main set the chart title, same as in \code{\link{plot}}
 #' @param xlab set the x-axis label, same as in \code{\link{plot}}
 #' @param ylab set the y-axis label, same as in \code{\link{plot}}
+#' @param xaxis if true, draws the x axis
+#' @param yaxis if true, draws the y axis
 #' @param colorset color palette to use, defaults to c("black", "\#005AFF"),
 #' where first value is used to color the step function and the second color is
 #' used for the fitted normal
 #' @param lwd set the line width, same as in \code{\link{plot}}
-#' @param xlim set the x-axis limit, same as in \code{\link{plot}}
-#' @param ylim set the y-axis limit, same as in \code{\link{plot}}
 #' @param element.color specify the color of chart elements.  Default is
 #' "darkgray"
 #' @param lty set the line type, same as in \code{\link{plot}}
@@ -38,7 +38,7 @@
 #' 
 #' 
 chart.ECDF <-
-function(R, main = "Empirical CDF", xlab="x", ylab="F(x)", colorset = c("black", "#005AFF"), lwd = 1, xlim = NULL, ylim = NULL, lty = c(1,1), element.color = "darkgray", ...)
+function(R, main = "Empirical CDF", xlab="x", ylab="F(x)", colorset = c("black", "#005AFF"), lwd = 1, lty = c(1,1), element.color = "darkgray", xaxis=TRUE, yaxis=TRUE, ...)
 { # @author Peter Carl
 
     # DESCRIPTION:
@@ -63,8 +63,10 @@
     plot(rx, stepy, type="s", col = colorset[1], xlab = xlab, ylab = ylab, main = main, axes = FALSE, lty = lty[1], lwd = lwd, ...)
     lines(t, p1, lty = lty[2], col = colorset[2], lwd = lwd, ...)
 
-    axis(1, cex.axis = 0.8, col = element.color)
-    axis(2, cex.axis = 0.8, col = element.color)
+    if(xaxis)
+      axis(1, cex.axis = 0.8, col = element.color)
+    if (yaxis)
+      axis(2, cex.axis = 0.8, col = element.color)
 
     box(col=element.color)
 

Modified: pkg/PerformanceAnalytics/R/chart.QQPlot.R
===================================================================
--- pkg/PerformanceAnalytics/R/chart.QQPlot.R	2012-04-27 16:16:12 UTC (rev 1916)
+++ pkg/PerformanceAnalytics/R/chart.QQPlot.R	2012-04-27 21:09:07 UTC (rev 1917)
@@ -19,6 +19,8 @@
 #' ideas.
 #' @param xlab set the x-axis label, as in \code{\link{plot}}
 #' @param ylab set the y-axis label, as in \code{\link{plot}}
+#' @param xaxis if true, draws the x axis
+#' @param yaxis if true, draws the y axis
 #' @param main set the chart title, same as in \code{plot}
 #' @param las set the direction of axis labels, same as in \code{plot}
 #' @param envelope confidence level for point-wise confidence envelope, or
@@ -78,7 +80,7 @@
 function(R, distribution="norm", ylab=NULL,
         xlab=paste(distribution, "Quantiles"), main=NULL, las=par("las"),
         envelope=FALSE, labels=FALSE, col=c(1,4), lwd=2, pch=1, cex=1,
-        line=c("quartiles", "robust", "none"), element.color = "darkgray", cex.axis = 0.8, cex.legend = 0.8, cex.lab = 1, cex.main = 1, ...)
+        line=c("quartiles", "robust", "none"), element.color = "darkgray", cex.axis = 0.8, cex.legend = 0.8, cex.lab = 1, cex.main = 1, xaxis=TRUE, yaxis=TRUE, ...)
 { # @author Peter Carl
 
     # DESCRIPTION:
@@ -192,10 +194,11 @@
 #     int = q.data[1] - slope* q.theo[1]
 # 
 #     if(line) abline(int, slope, col = colorset[2], lwd = 2)
+    if(xaxis)
+      axis(1, cex.axis = cex.axis, col = element.color)
+    if(yaxis)
+      axis(2, cex.axis = cex.axis, col = element.color)
 
-    axis(1, cex.axis = cex.axis, col = element.color)
-    axis(2, cex.axis = cex.axis, col = element.color)
-
     box(col=element.color)
 
 }



More information about the Returnanalytics-commits mailing list