[med-svn] [r-cran-beeswarm] 01/01: Imported Upstream version 0.2.3

Dylan Aïssi bob.dybian-guest at moszumanska.debian.org
Tue Apr 26 06:20:13 UTC 2016


This is an automated email from the git hooks/post-receive script.

bob.dybian-guest pushed a commit to branch upstream
in repository r-cran-beeswarm.

commit 2ed442025b2e2eb080b038ae09f7956361aef9b1
Author: Dylan Aïssi <bob.dybian at gmail.com>
Date:   Tue Apr 26 07:32:08 2016 +0200

    Imported Upstream version 0.2.3
---
 DESCRIPTION     |  8 ++++----
 MD5             |  8 ++++----
 NEWS            | 12 ++++++++++++
 R/beeswarm.R    | 29 +++++++++++++++++++++--------
 man/beeswarm.Rd | 10 ++++++----
 5 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 8ce6afb..6c6710d 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
 Package: beeswarm
-Version: 0.2.1
-Date: 2015-08-26
+Version: 0.2.3
+Date: 2016-04-25
 Title: The Bee Swarm Plot, an Alternative to Stripchart
 Author: Aron Eklund
 Maintainer: Aron Eklund <eklund at cbs.dtu.dk>
@@ -9,6 +9,6 @@ Description: The bee swarm plot is a one-dimensional scatter plot like "stripcha
 License: Artistic-2.0
 URL: http://www.cbs.dtu.dk/~eklund/beeswarm/
 NeedsCompilation: no
-Packaged: 2015-08-26 19:51:55 UTC; aron
+Packaged: 2016-04-25 13:59:08 UTC; aron
 Repository: CRAN
-Date/Publication: 2015-08-29 14:29:03
+Date/Publication: 2016-04-25 17:02:42
diff --git a/MD5 b/MD5
index c0003ef..9055e02 100644
--- a/MD5
+++ b/MD5
@@ -1,12 +1,12 @@
-c451e2c86a29d5c7d7a21bcf348778d3 *DESCRIPTION
+72e898030870647e36a4072f2b3bf141 *DESCRIPTION
 eb4e245537123b9485b4e0b3d00f4f61 *NAMESPACE
-c9c0f10f947940308d35aeed069c4aae *NEWS
-1c98d3ec63a0d15d8421d8295415888c *R/beeswarm.R
+0f1a8c25e6076cf4bec98ef778c7c46a *NEWS
+af10ea827c803e47a58f45504ee36349 *R/beeswarm.R
 99b47bff686cbb9afaf34e18a74ce49d *R/bxplot.R
 16cc12d2742742718c88949f18d5ac5d *R/zzz.R
 1a19e283dbfe0c6d3d8db1e0d21db033 *README.md
 bcf102fab14afb8d779c8c4148685174 *data/breast.RData
-25cf8f880ceab450935c22bc91bb5f74 *man/beeswarm.Rd
+346458956b02b410920368f5c5b7e14e *man/beeswarm.Rd
 1ee38a2972fa0874a81c807e36dd22a6 *man/breast.Rd
 d7097bb52220995656e837936b892d12 *man/bxplot.Rd
 39895501e8f57e66d39377f43cf0eae7 *man/swarmx.Rd
diff --git a/NEWS b/NEWS
index c822ca2..7bffc6d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,17 @@
 beeswarm NEWS
 
+
+Changes in version 0.2.3 (2016-04-25)
+
+- Fixed a bug in which specifying non-default "corral" and "side" arguments would result in unexpected results. (Issue #2)
+
+
+Changes in version 0.2.2 (2015-11-25)
+
+- Check that glim, dlim, xlim, ylim have length 2, thus avoiding confusing errors.
+- New argument "axes" (previously, trying to specify "axes" in ... would cause an error).
+
+
 Changes in version 0.2.1 (2015-08-26)
 
 - Corrected NAMESPACE and DESCRIPTION to properly indicate Imports and to remove unnecessary Depends.
diff --git a/R/beeswarm.R b/R/beeswarm.R
index 894c314..b29a743 100644
--- a/R/beeswarm.R
+++ b/R/beeswarm.R
@@ -21,7 +21,7 @@ beeswarm.default <- function(x,
     priority = c("ascending", "descending", "density", "random", "none"),
     pch = par("pch"), col = par("col"), bg = NA, 
     pwpch = NULL, pwcol = NULL, pwbg = NULL,
-    do.plot = TRUE, add = FALSE, log = FALSE, 
+    do.plot = TRUE, add = FALSE, axes = TRUE, log = FALSE, 
     xlim = NULL, ylim = NULL, dlim = NULL, glim = NULL,
     xlab = NULL, ylab = NULL, dlab = "", glab = "",
     ...) {
@@ -80,9 +80,13 @@ beeswarm.default <- function(x,
       } else {
         dlim <- extendrange(x.val, f = 0.01)
       }
+  } else if (length(dlim) != 2) {
+    stop ("'dlim' must have length 2")
   }
   if(is.null(glim)) {
     glim <- c(min(at) - 0.5, max(at) + 0.5)
+  } else if (length(glim) != 2) {
+    stop ("'glim' must have length 2")
   }
   if(horizontal) {        ## plot is horizontal
     if(is.null(ylim)) 
@@ -109,6 +113,10 @@ beeswarm.default <- function(x,
     if (is.null(xlab)) 
       xlab <- glab
   }
+  if(length(xlim) != 2)
+    stop ("'xlim' must have length 2")
+  if(length(ylim) != 2)
+    stop ("'ylim' must have length 2")
   
   #### Resolve plotting characters and colors
   if(is.null(pwpch)) {
@@ -248,18 +256,23 @@ beeswarm.default <- function(x,
       stopifnot(length(corralWidth) == 1)
       stopifnot(corralWidth > 0)
     }
-    halfCorralWidth <- corralWidth / 2
+    corralLo <- (side - 1) * corralWidth / 2
+    corralHi <- (side + 1) * corralWidth / 2
     if(corral == 'gutter') {
-      g.offset <- lapply(g.offset, function(zz) pmin(halfCorralWidth, pmax(-halfCorralWidth, zz)))
+      g.offset <- lapply(g.offset, function(zz) pmin(corralHi, pmax(corralLo, zz)))
     }
     if(corral == 'wrap') {
-      g.offset <- lapply(g.offset, function(zz) ((zz + halfCorralWidth) %% (halfCorralWidth * 2)) - halfCorralWidth)
+      if(side == -1) { ## special case with side=-1: reverse the corral to avoid artifacts at zero
+        g.offset <- lapply(g.offset, function(zz) corralHi - ((corralHi - zz) %% corralWidth))
+      } else {
+        g.offset <- lapply(g.offset, function(zz) ((zz - corralLo) %% corralWidth) + corralLo)
+      }
     }  
     if(corral == 'random') {
-      g.offset <- lapply(g.offset, function(zz) ifelse(zz > halfCorralWidth | zz < -halfCorralWidth, runif(length(zz), -halfCorralWidth, halfCorralWidth), zz))
+      g.offset <- lapply(g.offset, function(zz) ifelse(zz > corralHi | zz < corralLo, yes = runif(length(zz), corralLo, corralHi), no = zz))
     }
     if(corral == 'omit') {
-      g.offset <- lapply(g.offset, function(zz) ifelse(zz > halfCorralWidth, NA, ifelse(zz < -halfCorralWidth, NA, zz)))
+      g.offset <- lapply(g.offset, function(zz) ifelse(zz > corralHi | zz < corralLo, yes = NA, no = zz))
     }
   }
   
@@ -273,14 +286,14 @@ beeswarm.default <- function(x,
   if(do.plot) {
     if(horizontal) {     ## plot is horizontal
       points(out$y, out$x, pch = out$pch, col = out$col, bg = out$bg, cex = cex)  
-      if(!add) {
+      if(axes & !add) {
         axis(1, ...)
         axis(2, at = at, labels = labels, tick = FALSE, ...)
         box(...)
       }
     } else {             ## plot is vertical
       points(out$x, out$y, pch = out$pch, col = out$col, bg = out$bg, cex = cex)  
-      if(!add) {
+      if(axes & !add) {
         axis(2, ...)
         axis(1, at = at, labels = labels, tick = FALSE, ...)
         box(...)
diff --git a/man/beeswarm.Rd b/man/beeswarm.Rd
index 9c9040f..3e811e0 100644
--- a/man/beeswarm.Rd
+++ b/man/beeswarm.Rd
@@ -25,7 +25,7 @@ beeswarm(x, \dots)
     priority = c("ascending", "descending", "density", "random", "none"),
     pch = par("pch"), col = par("col"), bg = NA, 
     pwpch = NULL, pwcol = NULL, pwbg = NULL,
-    do.plot = TRUE, add = FALSE, log = FALSE,
+    do.plot = TRUE, add = FALSE, axes = TRUE, log = FALSE,
     xlim = NULL, ylim = NULL, dlim = NULL, glim = NULL,
     xlab = NULL, ylab = NULL, dlab = "", glab = "",
     \dots)
@@ -58,6 +58,7 @@ beeswarm(x, \dots)
   \item{pwpch, pwcol, pwbg}{ \dQuote{Point-wise} plotting characters and colors, specified for each data point (see Details). }
   \item{do.plot}{ Draw a plot? }
   \item{add}{ Add to an existing plot? }
+  \item{axes}{ Draw axes and box? }
   \item{log}{ Use a logarithmic scale on the data axis? }
   \item{xlim, ylim}{ Limits of the plot. }
   \item{dlim, glim}{ An alternative way to specify limits (see Details). }
@@ -97,6 +98,7 @@ When using the \code{"swarm"} method, \code{priority} controls the order in whic
 \seealso{ \code{\link{stripchart}}, \code{\link{boxplot}} }
 
 \examples{ 
+  
   ## One of the examples from 'stripchart'
   beeswarm(decrease ~ treatment,
     data = OrchardSprays, log = TRUE, 
@@ -126,9 +128,9 @@ When using the \code{"swarm"} method, \code{priority} controls the order in whic
     title = "Censored", pch = 16, col = 1:2)
 
   ## The list interface
-  distributions <- list(runif = runif(100, min = -3, max = 3), 
-                        rnorm = rnorm(100),
-                        rlnorm = rlnorm(100, sdlog = 0.5))
+  distributions <- list(runif = runif(200, min = -3, max = 3), 
+                        rnorm = rnorm(200),
+                        rlnorm = rlnorm(200, sdlog = 0.5))
   beeswarm(distributions, col = 2:4)
 
   ## Demonstrate 'pwcol' with the list interface 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-beeswarm.git



More information about the debian-med-commit mailing list