[med-svn] [r-cran-vioplot] 08/10: New upstream version 0.2

Andreas Tille tille at debian.org
Fri Sep 29 21:00:53 UTC 2017


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

tille pushed a commit to branch master
in repository r-cran-vioplot.

commit cd885b4bc3089cbcf7604a7276ad671246a241e9
Author: Andreas Tille <tille at debian.org>
Date:   Fri Sep 29 22:57:19 2017 +0200

    New upstream version 0.2
---
 DESCRIPTION          |  11 +++
 LICENSE              |  31 +++++++++
 NAMESPACE            |   1 +
 R/vioplot.R          | 185 +++++++++++++++++++++++++++++++++++++++++++++++++++
 debian/README.test   |   5 --
 debian/changelog     |  14 ----
 debian/compat        |   1 -
 debian/control       |  25 -------
 debian/copyright     |  38 -----------
 debian/docs          |   1 -
 debian/rules         |   8 ---
 debian/source/format |   1 -
 debian/watch         |   3 -
 man/vioplot.Rd       |  63 ++++++++++++++++++
 14 files changed, 291 insertions(+), 96 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
new file mode 100644
index 0000000..1cfae20
--- /dev/null
+++ b/DESCRIPTION
@@ -0,0 +1,11 @@
+Package: vioplot
+Version: 0.2
+Date: 2005-10-26
+Title: Violin plot
+Author: Daniel Adler <dadler at uni-goettingen.de>
+Maintainer: Daniel Adler <dadler at uni-goettingen.de>
+Depends: sm
+Description: A violin plot is a combination of a box plot and a kernel density plot. 
+License: BSD
+URL: http://wsopuppenkiste.wiso.uni-goettingen.de/~dadler
+Packaged: Wed Oct 26 18:46:49 2005; root
diff --git a/LICENSE b/LICENSE
new file mode 100755
index 0000000..515adb7
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,31 @@
+Copyright (c) 2004, Daniel Adler
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
+modification, are permitted provided that the following conditions 
+are met:
+
+    * Redistributions of source code must retain the above 
+      copyright notice, this list of conditions and the following 
+      disclaimer.
+    * Redistributions in binary form must reproduce the above 
+      copyright notice, this list of conditions and the following 
+      disclaimer in the documentation and/or other materials 
+      provided with the distribution.
+    * Neither the name of the University of Goettingen nor the 
+      names of its contributors may be used to endorse or promote 
+      products derived from this software without specific prior 
+      written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/NAMESPACE b/NAMESPACE
new file mode 100644
index 0000000..68cacdc
--- /dev/null
+++ b/NAMESPACE
@@ -0,0 +1 @@
+export(vioplot)
diff --git a/R/vioplot.R b/R/vioplot.R
new file mode 100755
index 0000000..4754b5f
--- /dev/null
+++ b/R/vioplot.R
@@ -0,0 +1,185 @@
+library(sm)
+vioplot <- function(x,...,range=1.5,h=NULL,ylim=NULL,names=NULL, horizontal=FALSE, 
+  col="magenta", border="black", lty=1, lwd=1, rectCol="black", colMed="white", pchMed=19, at, add=FALSE, wex=1, 
+  drawRect=TRUE)
+{
+    # process multiple datas
+    datas <- list(x,...)
+    n <- length(datas)
+   
+    if(missing(at)) at <- 1:n
+    
+    # pass 1
+    #
+    # - calculate base range
+    # - estimate density
+    #
+    
+    # setup parameters for density estimation
+    upper  <- vector(mode="numeric",length=n)
+    lower  <- vector(mode="numeric",length=n) 
+    q1     <- vector(mode="numeric",length=n)
+    q3     <- vector(mode="numeric",length=n)
+    med    <- vector(mode="numeric",length=n)
+    base   <- vector(mode="list",length=n)
+    height <- vector(mode="list",length=n)
+    baserange <- c(Inf,-Inf)
+    
+    # global args for sm.density function-call   
+    args <- list(display="none")
+       
+    if (!(is.null(h)))
+        args <- c(args, h=h)
+   
+            
+    for(i in 1:n) {
+
+        data<-datas[[i]]
+        
+        # calculate plot parameters
+        #   1- and 3-quantile, median, IQR, upper- and lower-adjacent
+        
+        data.min <- min(data)
+        data.max <- max(data)
+        q1[i]<-quantile(data,0.25)
+        q3[i]<-quantile(data,0.75)
+        med[i]<-median(data)
+        iqd <- q3[i]-q1[i]
+        upper[i] <- min( q3[i] + range*iqd, data.max )
+        lower[i] <- max( q1[i] - range*iqd, data.min )
+        
+       
+        #   strategy:
+        #       xmin = min(lower, data.min))
+        #       ymax = max(upper, data.max))
+        #
+
+        est.xlim <- c( min(lower[i], data.min), max(upper[i], data.max) ) 
+        
+        # estimate density curve
+        
+        smout <- do.call("sm.density", c( list(data, xlim=est.xlim), args ) )
+
+        
+        # calculate stretch factor
+        #
+        #  the plots density heights is defined in range 0.0 ... 0.5 
+        #  we scale maximum estimated point to 0.4 per data
+        #
+        
+        hscale <- 0.4/max(smout$estimate) * wex
+        
+        
+        # add density curve x,y pair to lists
+        
+        base[[i]]   <- smout$eval.points
+        height[[i]] <- smout$estimate * hscale
+        
+        
+        # calculate min,max base ranges
+        
+        t <- range(base[[i]])
+        baserange[1] <- min(baserange[1],t[1])
+        baserange[2] <- max(baserange[2],t[2])
+
+    }
+   
+    # pass 2
+    #
+    # - plot graphics
+    
+    # setup parameters for plot
+
+    if(!add){
+      xlim <- if(n==1) 
+               at + c(-.5, .5)
+              else 
+               range(at) + min(diff(at))/2 * c(-1,1)
+    
+      if (is.null(ylim)) {
+         ylim <- baserange
+      }
+    }
+    if (is.null(names)) {
+        label <- 1:n
+    } else {
+        label <- names
+    }
+
+    boxwidth <- 0.05 * wex
+    
+        
+    # setup plot
+
+    if(!add)
+      plot.new()
+    if(!horizontal) {
+      if(!add){
+        plot.window(xlim = xlim, ylim = ylim)
+        axis(2)
+        axis(1,at = at, label=label )
+      }  
+      
+      box()
+      
+      for(i in 1:n) {
+       
+          # plot left/right density curve
+        
+          polygon( c(at[i]-height[[i]], rev(at[i]+height[[i]])), 
+                   c(base[[i]], rev(base[[i]])),
+                   col = col, border=border, lty=lty, lwd=lwd)
+        
+        
+          if(drawRect){
+            # plot IQR
+            lines( at[c( i, i)], c(lower[i], upper[i]) ,lwd=lwd, lty=lty)
+        
+            # plot 50% KI box
+        
+            rect( at[i]-boxwidth/2, q1[i], at[i]+boxwidth/2, q3[i], col=rectCol)
+        
+            # plot median point
+        
+            points( at[i], med[i], pch=pchMed, col=colMed )
+         }
+      }
+
+    }
+    else {
+      if(!add){
+        plot.window(xlim = ylim, ylim = xlim)
+        axis(1)
+        axis(2,at = at, label=label )
+      }
+      
+      box()
+      for(i in 1:n) {
+       
+          # plot left/right density curve
+        
+          polygon( c(base[[i]], rev(base[[i]])),
+                   c(at[i]-height[[i]], rev(at[i]+height[[i]])),
+                   col = col, border=border, lty=lty, lwd=lwd)
+        
+        
+          if(drawRect){
+            # plot IQR
+            lines( c(lower[i], upper[i]), at[c(i,i)] ,lwd=lwd, lty=lty)
+        
+            # plot 50% KI box
+        
+            rect( q1[i], at[i]-boxwidth/2, q3[i], at[i]+boxwidth/2,  col=rectCol)
+        
+            # plot median point
+            points( med[i], at[i], pch=pchMed, col=colMed )
+          }
+      }
+
+      
+    }
+
+    
+    invisible (list( upper=upper, lower=lower, median=med, q1=q1, q3=q3))
+}
+
diff --git a/debian/README.test b/debian/README.test
deleted file mode 100644
index 31258d3..0000000
--- a/debian/README.test
+++ /dev/null
@@ -1,5 +0,0 @@
-Notes on how this package can be tested.
-========================================
-
-This package can be tested by loading it into R with the command
-'library(vioplot)' in order to confirm its integrity.
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
index 7d7409c..0000000
--- a/debian/changelog
+++ /dev/null
@@ -1,14 +0,0 @@
-r-cran-vioplot (0.2-2) unstable; urgency=medium
-
-  * Arch: all package does not need ${shlibs:Depends}
-    Closes: #792964
-  * Add ${misc:Depends}
-  * cme fix dpkg-control
-
- -- Andreas Tille <tille at debian.org>  Mon, 20 Jul 2015 15:15:51 +0200
-
-r-cran-vioplot (0.2-1) unstable; urgency=low
-
-  * Initial release. (Closes: #761665)
-
- -- Andreas Tille <tille at debian.org>  Mon, 15 Sep 2014 15:04:08 +0200
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index ec63514..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-9
diff --git a/debian/control b/debian/control
deleted file mode 100644
index 3a32cb5..0000000
--- a/debian/control
+++ /dev/null
@@ -1,25 +0,0 @@
-Source: r-cran-vioplot
-Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
-Uploaders: Steffen Moeller <moeller at debian.org>,
-           Andreas Tille <tille at debian.org>
-Section: gnu-r
-Priority: optional
-Build-Depends: debhelper (>= 9),
-               cdbs,
-               r-base-dev (>= 3.0),
-               r-cran-sm
-Standards-Version: 3.9.6
-Vcs-Browser: http://anonscm.debian.org/viewvc/debian-med/trunk/packages/R/r-cran-vioplot/trunk/
-Vcs-Svn: svn://anonscm.debian.org/debian-med/trunk/packages/R/r-cran-vioplot/trunk/
-Homepage: http://cran.r-project.org/web/packages/vioplot/index.html
-
-Package: r-cran-vioplot
-Architecture: all
-Depends: ${R:Depends},
-         ${misc:Depends},
-         r-cran-sm
-Description: GNU R toolbox for violin plots
- Violin plots are a method of plotting numeric data. A violin plot is a
- combination of a box plot and a kernel density plot. Specifically, it
- starts with a box plot. It then adds a rotated kernel density plot to
- each side of the box plot.
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644
index cc7b402..0000000
--- a/debian/copyright
+++ /dev/null
@@ -1,38 +0,0 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: vioplot
-Upstream-Contact: Daniel Adler  <adler at uni-goettingen.de>
-Source: http://cran.r-project.org/web/packages/vioplot/index.html
-
-Files: *
-Copyright: © 2005 Daniel Adler  <adler at uni-goettingen.de>
-License: BSD-3-Clause
-
-Files: debian/*
-Copyright: 2014 Steffen Moeller <moeller at debian.org>,
-                Andreas Tille <tille at debian.org>
-License: BSD-3-Clause
-
-License: BSD-3-Clause
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in the
-    documentation and/or other materials provided with the distribution.
- 3. Neither the name of the University nor the names of its contributors
-    may be used to endorse or promote products derived from this software
-    without specific prior written permission.
- .
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
- A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE HOLDERS OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/debian/docs b/debian/docs
deleted file mode 100644
index 50f6656..0000000
--- a/debian/docs
+++ /dev/null
@@ -1 +0,0 @@
-debian/README.test
diff --git a/debian/rules b/debian/rules
deleted file mode 100755
index e65d5ff..0000000
--- a/debian/rules
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/make -f
-
-export DEB_BUILD_HARDENING=1
-export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-include /usr/share/R/debian/r-cran.mk
-
-install/$(package)::
-	rm -rf debian/$(package)/usr/lib/R/site-library/$(cranName)/LICENSE
diff --git a/debian/source/format b/debian/source/format
deleted file mode 100644
index 163aaf8..0000000
--- a/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/debian/watch b/debian/watch
deleted file mode 100644
index 5df2747..0000000
--- a/debian/watch
+++ /dev/null
@@ -1,3 +0,0 @@
-version=3
-http://cran.r-project.org/src/contrib/vioplot_([-0-9\.]*)\.tar\.gz
-
diff --git a/man/vioplot.Rd b/man/vioplot.Rd
new file mode 100755
index 0000000..4437722
--- /dev/null
+++ b/man/vioplot.Rd
@@ -0,0 +1,63 @@
+\name{vioplot}
+\alias{vioplot}
+\title{violin plot}
+\description{
+  Produce violin plot(s) of the given (grouped) values.
+}
+\usage{
+vioplot( x, ..., range=1.5, h, ylim, names, horizontal=FALSE, 
+  col="magenta", border="black", lty=1, lwd=1, rectCol="black", 
+  colMed="white", pchMed=19, at, add=FALSE, wex=1, 
+  drawRect=TRUE)
+}
+\arguments{
+  \item{x}{data vector}
+  \item{...}{additional data vectors} 
+  \item{range}{a factor to calculate the upper/lower adjacent values}
+  \item{h}{the height for the density estimator, if omit as explained in sm.density, h will be set to an optimum}
+  \item{ylim}{y limits}
+  \item{names}{one label, or a vector of labels for the datas must match the number of datas given}
+  \item{col, border, lty, lwd}{Graphical parameters for the violin passed to lines and polygon}
+  \item{rectCol, colMed, pchMed}{Graphical parameters to control the look of the box}
+  \item{drawRect}{logical. the box is drawn if \code{TRUE}.}
+  \item{at}{position of each violin. Default to \code{1:n}}
+  \item{add}{logical. if FALSE (default) a new plot is created}
+  \item{wex}{relative expansion of the violin. }
+  \item{horizontal}{logical. horizontal or vertical violins}
+}
+\details{
+ A violin plot is a combination of a box plot and a kernel density plot. 
+ Specifically, it starts with a box plot. It then adds a rotated kernel density plot to each side of the box plot.
+}
+\examples{
+  # box- vs violin-plot 
+  par(mfrow=c(2,1))
+  mu<-2
+  si<-0.6
+  bimodal<-c(rnorm(1000,-mu,si),rnorm(1000,mu,si)) 
+  uniform<-runif(2000,-4,4)
+  normal<-rnorm(2000,0,3)
+  vioplot(bimodal,uniform,normal)
+  boxplot(bimodal,uniform,normal)
+  
+  # add to an existing plot
+  x <- rnorm(100)
+  y <- rnorm(100)
+  plot(x, y, xlim=c(-5,5), ylim=c(-5,5))
+  vioplot(x, col="tomato", horizontal=TRUE, at=-4, add=TRUE,lty=2, rectCol="gray")
+  vioplot(y, col="cyan", horizontal=FALSE, at=-4, add=TRUE,lty=2)
+}
+\seealso{
+  \code{\link{boxplot}}
+  \code{\link[sm]{sm}}
+}
+\references{
+  Hintze, J. L. and R. D. Nelson (1998).  \emph{Violin plots: a box plot-density trace
+synergism.}  The American Statistician, 52(2):181-4.
+}
+\author{Daniel Adler \email{dadler at uni-goettingen.de}
+  
+  Romain Francois \email{francoisromain at free.fr} ; \url{http://francoisromain.free.fr} : 
+  horizontal violins and additionnal graphical parameters }
+\keyword{hplot}
+

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



More information about the debian-med-commit mailing list