[Robast-commits] r723 - in branches/robast-1.0/pkg/RobAStBase: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Feb 24 21:55:47 CET 2014


Author: ruckdeschel
Date: 2014-02-24 21:55:46 +0100 (Mon, 24 Feb 2014)
New Revision: 723

Modified:
   branches/robast-1.0/pkg/RobAStBase/R/comparePlot.R
   branches/robast-1.0/pkg/RobAStBase/R/ddPlot.R
   branches/robast-1.0/pkg/RobAStBase/R/ddPlot_utils.R
   branches/robast-1.0/pkg/RobAStBase/R/infoPlot.R
   branches/robast-1.0/pkg/RobAStBase/R/outlyingPlot.R
   branches/robast-1.0/pkg/RobAStBase/R/plotRescaledAxis.R
   branches/robast-1.0/pkg/RobAStBase/man/ddPlot-methods.Rd
   branches/robast-1.0/pkg/RobAStBase/man/internals_ddPlot.Rd
   branches/robast-1.0/pkg/RobAStBase/man/outlyingPlotIC.Rd
Log:
RobAStBase: fixed some diagnostic plots: 
+ comparePlot now plots the whole range
+ ddPlots / outlyingPlot.R now have alpha transparency and jitter and cex.pts
+ infoPlot plots the correct y-axis (no overplotting)

Modified: branches/robast-1.0/pkg/RobAStBase/R/comparePlot.R
===================================================================
--- branches/robast-1.0/pkg/RobAStBase/R/comparePlot.R	2014-02-24 17:58:37 UTC (rev 722)
+++ branches/robast-1.0/pkg/RobAStBase/R/comparePlot.R	2014-02-24 20:55:46 UTC (rev 723)
@@ -28,7 +28,8 @@
                        expand.dots = FALSE)$"..."
         dotsP <- dots
         dotsLeg <- dotsT <- dotsL <- .makedotsLowLevel(dots)
-
+        dots.points <-   .makedotsPt(dots)
+        
         ncomp <- 2+ (!missing(obj3)|!is.null(obj3)) +
                     (!missing(obj4)|!is.null(obj4))
 
@@ -321,13 +322,21 @@
                 matp  <- cbind(matp,resc4$Y)
             }
 
-            do.call(plot, args=c(list(x = resc1$X, y = matp[,1],
-                 type = plty, lty = lty, col = col[1], lwd = lwd,
-                 xlab = xlab, ylab = ylab), dotsP, list(panel.last = pL)))
-                 
-            do.call(matlines, args = c(list( x = resc1$X, y = matp[,-1],
-                    lty = lty, col = col[-1], lwd = lwd), dotsL))
+            ym <- min(matp,na.rm=T)
+            yM <- max(matp,na.rm=T)
+            y0 <- matp[,1]
+            y0[1:2] <- c(ym,yM)
+            do.call(plot, args=c(list(x = resc1$X, y = y0,
+                 type = "n", xlab = xlab, ylab = ylab,
+                 lty = lty[1], col = addAlphTrsp2col(col[1],0),
+                 lwd = lwd[1]), dotsP, list(panel.last = pL)))
+            if(plty=="p")
+               do.call(matpoints, args = c(list( x = resc1$X, y = matp,
+                    col = col), dots.points))
 
+            do.call(matlines, args = c(list( x = resc1$X, y = matp,
+                    lty = lty, col = col, lwd = lwd), dotsL))
+
             .plotRescaledAxis(scaleX, scaleX.fct, scaleX.inv,
                               scaleY,scaleY.fct, scaleY.inv, xlim[,i],
                               ylim[,i], resc1$X, ypts = 400, n = scaleN,

Modified: branches/robast-1.0/pkg/RobAStBase/R/ddPlot.R
===================================================================
--- branches/robast-1.0/pkg/RobAStBase/R/ddPlot.R	2014-02-24 17:58:37 UTC (rev 722)
+++ branches/robast-1.0/pkg/RobAStBase/R/ddPlot.R	2014-02-24 20:55:46 UTC (rev 723)
@@ -3,7 +3,7 @@
        cutoff.x, cutoff.y, ...,
        cutoff.quantile.x = 0.95, cutoff.quantile.y = cutoff.quantile.x,
        transform.x, transform.y = transform.x,
-       id.n, lab.pts, adj, cex.idn,
+       id.n, cex.pts = 1,lab.pts, jitt.pts = 0, alpha.trsp = NA, adj =0, cex.idn,
        col.idn, lty.cutoff, lwd.cutoff, col.cutoff, text.abline = TRUE,
        text.abline.x = NULL, text.abline.y = NULL,
        cex.abline = par("cex"), col.abline = col.cutoff,
@@ -24,7 +24,7 @@
        cutoff.x, cutoff.y, ...,
        cutoff.quantile.x = 0.95, cutoff.quantile.y = cutoff.quantile.x,
        transform.x, transform.y = transform.x,
-       id.n, lab.pts, adj, cex.idn,
+       id.n, cex.pts = 1,lab.pts, jitt.pts = 0, alpha.trsp = NA, adj =0, cex.idn,
        col.idn, lty.cutoff, lwd.cutoff, col.cutoff, text.abline = TRUE,
        text.abline.x = NULL, text.abline.y = NULL,
        cex.abline = par("cex"), col.abline = col.cutoff,
@@ -45,7 +45,7 @@
        cutoff.x, cutoff.y, ...,
        cutoff.quantile.x = 0.95, cutoff.quantile.y = cutoff.quantile.x,
        transform.x, transform.y = transform.x,
-       id.n, lab.pts, adj, cex.idn,
+       id.n, cex.pts = 1,lab.pts, jitt.pts = 0, alpha.trsp = NA, adj =0, cex.idn,
        col.idn, lty.cutoff, lwd.cutoff, col.cutoff,
        text.abline = TRUE,
        text.abline.x = NULL, text.abline.y = NULL,

Modified: branches/robast-1.0/pkg/RobAStBase/R/ddPlot_utils.R
===================================================================
--- branches/robast-1.0/pkg/RobAStBase/R/ddPlot_utils.R	2014-02-24 17:58:37 UTC (rev 722)
+++ branches/robast-1.0/pkg/RobAStBase/R/ddPlot_utils.R	2014-02-24 20:55:46 UTC (rev 723)
@@ -8,7 +8,10 @@
                                 transform.x,
                                 transform.y = transform.x,
                                 id.n,
+                                cex.pts = 1,
                                 lab.pts,
+                                jitt.pts = 0,
+                                alpha.trsp = NA,
                                 adj =0,
                                 cex.idn = 1,
                                 col.idn = par("col"),
@@ -29,6 +32,12 @@
 
        dots <- match.call(expand.dots = FALSE)$"..."
 
+       jitt.pts <- rep(jitt.pts,length.out=2)
+
+       col <- if(is.null(dots$col)) par("col") else dots$col
+       if(!is.na(alpha.trsp)) col <- addAlphTrsp2col(col, alpha.trsp)
+
+
        id.n1 <- 1:ncol(data)
 
        if(missing(id.n) || is.null(id.n))
@@ -116,6 +125,8 @@
       if(missing(font.abline) && !is.null(dots$font)) font.abline <- dots$font
 
       pdots <- .makedotsLowLevel(dots)
+      pdots$pch <- if(is.null(dots$pch)) "." else dots$pch
+      pdots$cex <- cex.pts
       pdots$xlab <- dots$xlab
       pdots$ylab <- dots$ylab
       pdots$nsim <- NULL
@@ -232,12 +243,16 @@
       id0.x <- id.n1[id.x]
       id0.y <- id.n1[id.y]
 
-      if(any(duplicated(ndata.x)&duplicated(ndata.y))){
-          ndata.x <- jitter(ndata.x, factor=jitt.fac)
-          ndata.y <- jitter(ndata.y, factor=jitt.fac)
-      }
+      ndata.x0 <- ndata.x
+      ndata.y0 <- ndata.y
+      isna <- is.na(ndata.x0)|is.na(ndata.y0)
+      if(any(duplicated(ndata.x0[!isna])))
+          ndata.x0[!isna] <- jitter(ndata.x0[!isna], factor=jitt.pts[1])
+      if(any(duplicated(ndata.y0[!isna])))
+          ndata.y0[!isna] <- jitter(ndata.y0[!isna], factor=jitt.pts[2])
 
-      do.call(plot, args = c(list(x = ndata.x, y=ndata.y, type = "p"), pdots))
+      pdots$col <- col
+      do.call(plot, args = c(list(x = ndata.x0, y=ndata.y0, type = "p"), pdots))
       do.call(box,args=c(adots))
 
       pusr <- par("usr")

Modified: branches/robast-1.0/pkg/RobAStBase/R/infoPlot.R
===================================================================
--- branches/robast-1.0/pkg/RobAStBase/R/infoPlot.R	2014-02-24 17:58:37 UTC (rev 722)
+++ branches/robast-1.0/pkg/RobAStBase/R/infoPlot.R	2014-02-24 20:55:46 UTC (rev 723)
@@ -443,8 +443,8 @@
                    dotsP1))
                do.call(lines, args=c(list(resc$X, resc$Y, type = plty,
                        lty = lty, lwd = lwd, col = col), dotsL))
-               scaleX0 <- (xaxt0[1]!="n")
-               scaleY0 <- (yaxt0[1]!="n")
+               scaleX0 <- scaleX & (xaxt0[1]!="n")
+               scaleY0 <- scaleY & (yaxt0[1]!="n")
                x.ticks0 <- if(xaxt0[1]!="n") x.ticks else NULL
                y.ticks0 <- if(yaxt0[1]!="n") y.ticks[[1]] else NULL
                .plotRescaledAxis(scaleX0, scaleX.fct, scaleX.inv,
@@ -497,8 +497,8 @@
 
                     do.call(lines, args = c(list(resc.C$X, y.vec1C, type = plty,
                             lty = ltyI, col = colI, lwd = lwdI), dotsL))
-                    scaleX0 <- (xaxt0[i+in1to.draw]!="n")
-                    scaleY0 <- (yaxt0[i+in1to.draw]!="n")
+                    scaleX0 <- scaleX & (xaxt0[i+in1to.draw]!="n")
+                    scaleY0 <- scaleY & (yaxt0[i+in1to.draw]!="n")
                     x.ticks0 <- if(xaxt0[i+in1to.draw]!="n") x.ticks else NULL
                     y.ticks0 <- if(yaxt0[i+in1to.draw]!="n") y.ticks[[i+in1to.draw]] else NULL
                     .plotRescaledAxis(scaleX0, scaleX.fct, scaleX.inv,

Modified: branches/robast-1.0/pkg/RobAStBase/R/outlyingPlot.R
===================================================================
--- branches/robast-1.0/pkg/RobAStBase/R/outlyingPlot.R	2014-02-24 17:58:37 UTC (rev 722)
+++ branches/robast-1.0/pkg/RobAStBase/R/outlyingPlot.R	2014-02-24 20:55:46 UTC (rev 723)
@@ -9,8 +9,11 @@
                            cutoff.quantile.x = 0.95,
                            cutoff.quantile.y = cutoff.quantile.x,
                            id.n,
-                           lab.pts, 
-                           adj, 
+                           cex.pts = 1,
+                           lab.pts,
+                           jitt.pts = 0,
+                           alpha.trsp = NA,
+                           adj,
                            cex.idn,
                            col.idn, 
                            lty.cutoff, 
@@ -25,6 +28,7 @@
                            ){
      mc <- as.list(match.call(expand.dots = FALSE))[-1]
      dots <- mc$"..."
+
      if(is.null(dots$xlim)) dots$xlim <- TRUE
      if(is.null(dots$ylim)) dots$ylim <- TRUE
      if(is.null(mc$cutoff.quantile.x)) mc$cutoff.quantile.x <- 0.95
@@ -130,6 +134,8 @@
        transform.y = tf.y,
        id.n = mc$id.n, 
        lab.pts = mc$lab.pts, 
+       alpha.trsp = alpha.trsp,
+       cex.pts = cex.pts,
        adj = mc$adj, 
        cex.idn = mc$cex.idn,
        col.idn = mc$col.idn, 

Modified: branches/robast-1.0/pkg/RobAStBase/R/plotRescaledAxis.R
===================================================================
--- branches/robast-1.0/pkg/RobAStBase/R/plotRescaledAxis.R	2014-02-24 17:58:37 UTC (rev 722)
+++ branches/robast-1.0/pkg/RobAStBase/R/plotRescaledAxis.R	2014-02-24 20:55:46 UTC (rev 723)
@@ -100,7 +100,7 @@
                if(-Inf %in% x.ticks) axis(1,at=0,labels=expression(-infinity))
                if(Inf %in% x.ticks)  axis(1,at=1,labels=expression(infinity))
             }
-            box()
+            if(withbox) box()
         }else{
             if(!is.null(x.ticks)){
                if(is.null(xlim)){ xlim <- c(-Inf,Inf)}else{
@@ -111,7 +111,7 @@
                axis(1,at=xf,labels=xf)
                if(-Inf %in% x.ticks) axis(1,at=0,labels=expression(-infinity))
                if(Inf %in% x.ticks)  axis(1,at=1,labels=expression(infinity))
-               box()
+               if(withbox) box()
             }
         }
         if(scaleY){
@@ -150,7 +150,7 @@
                if(-Inf %in% y.ticks) axis(2,at=0,labels=expression(-infinity))
                if(Inf %in% y.ticks)  axis(2,at=1,labels=expression(infinity))
             }
-            box()
+            if(withbox) box()
         }else{
             if(!is.null(y.ticks)){
                if(is.null(ylim)){ ylim <- c(-Inf,Inf)}else{
@@ -161,7 +161,7 @@
                axis(2,at=yf,labels=yf)
                if(-Inf %in% y.ticks) axis(2,at=0,labels=expression(-infinity))
                if(Inf %in% y.ticks)  axis(2,at=1,labels=expression(infinity))
-               box()
+               if(withbox) box()
            }
         }
    return(invisible(NULL))

Modified: branches/robast-1.0/pkg/RobAStBase/man/ddPlot-methods.Rd
===================================================================
--- branches/robast-1.0/pkg/RobAStBase/man/ddPlot-methods.Rd	2014-02-24 17:58:37 UTC (rev 722)
+++ branches/robast-1.0/pkg/RobAStBase/man/ddPlot-methods.Rd	2014-02-24 20:55:46 UTC (rev 723)
@@ -13,7 +13,7 @@
        cutoff.x, cutoff.y, ...,
        cutoff.quantile.x = 0.95, cutoff.quantile.y = cutoff.quantile.x,
        transform.x, transform.y = transform.x,
-       id.n, lab.pts, adj, cex.idn,
+       id.n, cex.pts = 1,lab.pts, jitt.pts = 0, alpha.trsp = NA, adj =0, cex.idn,
        col.idn, lty.cutoff, lwd.cutoff, col.cutoff, text.abline = TRUE,
        text.abline.x = NULL, text.abline.y = NULL,
        cex.abline = par("cex"), col.abline = col.cutoff,
@@ -27,7 +27,7 @@
        cutoff.x, cutoff.y, ...,
        cutoff.quantile.x = 0.95, cutoff.quantile.y = cutoff.quantile.x,
        transform.x, transform.y = transform.x,
-       id.n, lab.pts, adj, cex.idn,
+       id.n, cex.pts = 1,lab.pts, jitt.pts = 0, alpha.trsp = NA, adj =0, cex.idn,
        col.idn, lty.cutoff, lwd.cutoff, col.cutoff, text.abline = TRUE,
        text.abline.x = NULL, text.abline.y = NULL,
        cex.abline = par("cex"), col.abline = col.cutoff,
@@ -41,7 +41,7 @@
        cutoff.x, cutoff.y, ...,
        cutoff.quantile.x = 0.95, cutoff.quantile.y = cutoff.quantile.x,
        transform.x, transform.y = transform.x,
-       id.n, lab.pts, adj, cex.idn,
+       id.n, cex.pts = 1,lab.pts, jitt.pts = 0, alpha.trsp = NA, adj =0, cex.idn,
        col.idn, lty.cutoff, lwd.cutoff, col.cutoff, text.abline = TRUE,
        text.abline.x = NULL, text.abline.y = NULL,
        cex.abline = par("cex"), col.abline = col.cutoff,
@@ -69,7 +69,18 @@
   distances of the \code{y} axis.}
   \item{id.n}{a set of indices (or a corresponding logical vector); to select a subset
   of the data in argument \code{data}.}
+  \item{cex.pts}{the corresponding \code{cex} argument for plotted points.}
   \item{lab.pts}{a vector of labels for the (unsubsetted) \code{data}.}
+  \item{jitt.pts}{the corresponding \code{jitter} argument for plotted points;
+    may be a vector of length 2 -- for separate factors for x- and y-coordinate.}
+  \item{alpha.trsp}{alpha transparency to be added ex post to colors
+        \code{col.pch} and \code{col.lbl}; if one-dim and NA all colors are
+        left unchanged. Otherwise, with usual recycling rules \code{alpha.trsp}
+        gets shorted/prolongated to length the data-symbols to be plotted.
+        Coordinates of this vector \code{alpha.trsp} with NA are left unchanged,
+        while for the remaining ones, the alpha channel in rgb space is set
+        to the respective coordinate value of \code{alpha.trsp}. The non-NA
+        entries must be integers in [0,255] (0 invisible, 255 opaque).}
   \item{adj}{the corresponding argument for \code{\link[graphics]{text}} for
              labelling the outliers.}
   \item{cex.idn}{the corresponding \code{cex} argument for

Modified: branches/robast-1.0/pkg/RobAStBase/man/internals_ddPlot.Rd
===================================================================
--- branches/robast-1.0/pkg/RobAStBase/man/internals_ddPlot.Rd	2014-02-24 17:58:37 UTC (rev 722)
+++ branches/robast-1.0/pkg/RobAStBase/man/internals_ddPlot.Rd	2014-02-24 20:55:46 UTC (rev 723)
@@ -13,7 +13,7 @@
        cutoff.y = cutoff(norm = dist.y, cutoff.quantile  = cutoff.quantile.y),
        cutoff.quantile.x = 0.95, cutoff.quantile.y = cutoff.quantile.x,
        transform.x, transform.y = transform.x,
-       id.n, lab.pts, adj =0, cex.idn,
+       id.n, cex.pts = 1,lab.pts, jitt.pts = 0, alpha.trsp = NA, adj =0, cex.idn,
        col.idn, lty.cutoff,
        lwd.cutoff, col.cutoff = "red", text.abline = TRUE,
        text.abline.x = NULL, text.abline.y = NULL,
@@ -43,7 +43,18 @@
   distances of the \code{y} axis.}
   \item{id.n}{a set of indices (or a corresponding logical vector); to select a subset
   of the data in argument \code{data}.}
+  \item{cex.pts}{the corresponding \code{cex} argument for plotted points.}
   \item{lab.pts}{a vector of labels for the (unsubsetted) \code{data}.}
+  \item{jitt.pts}{the corresponding \code{jitter} argument for plotted points;
+    may be a vector of length 2 -- for separate factors for x- and y-coordinate.}
+  \item{alpha.trsp}{alpha transparency to be added ex post to colors
+        \code{col.pch} and \code{col.lbl}; if one-dim and NA all colors are
+        left unchanged. Otherwise, with usual recycling rules \code{alpha.trsp}
+        gets shorted/prolongated to length the data-symbols to be plotted.
+        Coordinates of this vector \code{alpha.trsp} with NA are left unchanged,
+        while for the remaining ones, the alpha channel in rgb space is set
+        to the respective coordinate value of \code{alpha.trsp}. The non-NA
+        entries must be integers in [0,255] (0 invisible, 255 opaque).}
   \item{adj}{the corresponding argument for \code{\link[graphics]{text}} for
              labelling the outliers.}
   \item{cex.idn}{the corresponding \code{cex} argument for

Modified: branches/robast-1.0/pkg/RobAStBase/man/outlyingPlotIC.Rd
===================================================================
--- branches/robast-1.0/pkg/RobAStBase/man/outlyingPlotIC.Rd	2014-02-24 17:58:37 UTC (rev 722)
+++ branches/robast-1.0/pkg/RobAStBase/man/outlyingPlotIC.Rd	2014-02-24 20:55:46 UTC (rev 723)
@@ -7,8 +7,9 @@
 outlyingPlotIC(data, IC.x, IC.y = IC.x, dist.x = NormType(),
                dist.y, cutoff.y = cutoff.chisq(), cutoff.x = cutoff.sememp(),
                ..., cutoff.quantile.x = 0.95,
-               cutoff.quantile.y = cutoff.quantile.x, id.n, lab.pts, adj,
-               cex.idn, col.idn, lty.cutoff, lwd.cutoff, col.cutoff,
+               cutoff.quantile.y = cutoff.quantile.x,
+               id.n, cex.pts = 1,lab.pts, jitt.pts = 0, alpha.trsp = NA,
+               adj =0, cex.idn, col.idn, lty.cutoff, lwd.cutoff, col.cutoff,
                robCov.x = TRUE, robCov.y = TRUE, tf.x = data, tf.y = data,
                jitt.fac = 10,
                main = gettext("Outlyingness \n by means of a distance-distance plot")
@@ -31,7 +32,18 @@
   \item{cutoff.quantile.y}{numeric; the cutoff quantile for the \code{y} axis.}
   \item{id.n}{a set of indices (or a corresponding logical vector); to select a subset
   of the data in argument \code{data}.}
+  \item{cex.pts}{the corresponding \code{cex} argument for plotted points.}
   \item{lab.pts}{a vector of labels for the (unsubsetted) \code{data}.}
+  \item{jitt.pts}{the corresponding \code{jitter} argument for plotted points;
+    may be a vector of length 2 -- for separate factors for x- and y-coordinate.}
+  \item{alpha.trsp}{alpha transparency to be added ex post to colors
+        \code{col.pch} and \code{col.lbl}; if one-dim and NA all colors are
+        left unchanged. Otherwise, with usual recycling rules \code{alpha.trsp}
+        gets shorted/prolongated to length the data-symbols to be plotted.
+        Coordinates of this vector \code{alpha.trsp} with NA are left unchanged,
+        while for the remaining ones, the alpha channel in rgb space is set
+        to the respective coordinate value of \code{alpha.trsp}. The non-NA
+        entries must be integers in [0,255] (0 invisible, 255 opaque).}
   \item{adj}{the corresponding argument for \code{\link[graphics]{text}} for
              labelling the outliers.}
   \item{cex.idn}{the corresponding \code{cex} argument for



More information about the Robast-commits mailing list