[med-svn] [r-cran-shape] 02/04: New upstream version 1.4.2
Andreas Tille
tille at debian.org
Fri Sep 29 13:38:43 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-shape.
commit f7900ab9a5e6705b507c5dd87f91cf6cc18bf80f
Author: Andreas Tille <tille at debian.org>
Date: Fri Sep 29 15:36:22 2017 +0200
New upstream version 1.4.2
---
DESCRIPTION | 18 ++
MD5 | 60 +++++
NAMESPACE | 2 +
R/A4.R | 11 +
R/Arrowhead.R | 90 ++++++++
R/Arrows.R | 58 +++++
R/colorlegend.R | 91 ++++++++
R/cylindersegment.R | 41 ++++
R/drapecol.R | 30 +++
R/emptyplot.R | 16 ++
R/femmecol.R | 21 ++
R/filledcircle.R | 18 ++
R/filledcylinder.R | 71 ++++++
R/filledellipse.R | 27 +++
R/filledmultigonal.R | 18 ++
R/filledrectangle.R | 43 ++++
R/filledshape.R | 70 ++++++
R/getellipse.R | 19 ++
R/greycol.R | 14 ++
R/intpalette.R | 30 +++
R/plotcircle.R | 15 ++
R/plotellipse.R | 40 ++++
R/rotatexy.R | 29 +++
R/roundrect.R | 21 ++
R/shadepalette.R | 12 +
R/shape.R | 42 ++++
R/textflag.R | 53 +++++
R/writelabel.R | 20 ++
build/vignette.rds | Bin 0 -> 239 bytes
debian/README.test | 8 -
debian/changelog | 5 -
debian/compat | 1 -
debian/control | 20 --
debian/copyright | 26 ---
debian/docs | 2 -
debian/examples | 1 -
debian/rules | 3 -
debian/source/format | 1 -
debian/tests/control | 3 -
debian/tests/run-unit-test | 19 --
debian/watch | 2 -
demo/00Index | 1 +
demo/colorshapes.r | 334 +++++++++++++++++++++++++++
inst/doc/shape.R | 557 +++++++++++++++++++++++++++++++++++++++++++++
inst/doc/shape.Rnw | 440 +++++++++++++++++++++++++++++++++++
inst/doc/shape.pdf | Bin 0 -> 688695 bytes
man/A4.Rd | 20 ++
man/Arrowhead.Rd | 92 ++++++++
man/Arrows.Rd | 161 +++++++++++++
man/colorlegend.Rd | 83 +++++++
man/cylindersegment.Rd | 79 +++++++
man/drapecol.Rd | 49 ++++
man/emptyplot.Rd | 37 +++
man/femmecol.Rd | 41 ++++
man/filledcircle.Rd | 85 +++++++
man/filledcylinder.Rd | 102 +++++++++
man/filledellipse.Rd | 114 ++++++++++
man/filledmultigonal.Rd | 112 +++++++++
man/filledrectangle.Rd | 100 ++++++++
man/filledshape.Rd | 98 ++++++++
man/getellipse.Rd | 77 +++++++
man/greycol.Rd | 46 ++++
man/intpalette.Rd | 56 +++++
man/plotcircle.Rd | 58 +++++
man/plotellipse.Rd | 117 ++++++++++
man/rotatexy.Rd | 55 +++++
man/roundrect.Rd | 56 +++++
man/shadepalette.Rd | 43 ++++
man/shape.Rd | 67 ++++++
man/textflag.Rd | 75 ++++++
man/writelabel.Rd | 36 +++
vignettes/shape.Rnw | 440 +++++++++++++++++++++++++++++++++++
vignettes/vignettes.bib | 87 +++++++
73 files changed, 4698 insertions(+), 91 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
new file mode 100644
index 0000000..b139b22
--- /dev/null
+++ b/DESCRIPTION
@@ -0,0 +1,18 @@
+Package: shape
+Version: 1.4.2
+Date: 2014-06-01
+Title: Functions for plotting graphical shapes, colors
+Author: Karline Soetaert <karline.soetaert at nioz.nl>
+Maintainer: Karline Soetaert <karline.soetaert at nioz.nl>
+Depends: R (>= 2.01), stats
+Description: Functions for plotting graphical shapes
+ such as ellipses, circles, cylinders, arrows, ...
+License: GPL (>= 3)
+LazyData: yes
+Packaged: 2014-11-01 08:24:56 UTC; rforge
+Repository: CRAN
+Repository/R-Forge/Project: diagram
+Repository/R-Forge/Revision: 68
+Repository/R-Forge/DateTimeStamp: 2014-11-01 08:20:54
+Date/Publication: 2014-11-05 14:14:32
+NeedsCompilation: no
diff --git a/MD5 b/MD5
new file mode 100644
index 0000000..0a8a709
--- /dev/null
+++ b/MD5
@@ -0,0 +1,60 @@
+a5ce489655bb2f86d2e435aac207623b *DESCRIPTION
+d3cef2136fa9a712a3f4dec02c59e969 *NAMESPACE
+efa927382bbe9a530ada0f4d38e99be6 *R/A4.R
+98f9537d32de4a1a015cf1da2c59d6c5 *R/Arrowhead.R
+1d7acd3cc09a34c7abc218c904c5fa98 *R/Arrows.R
+19cb3f505acade9ba0a4e9ab80eff311 *R/colorlegend.R
+cc167725e526aeb0764fbe783bc8cfc5 *R/cylindersegment.R
+ddca2475a00d273e26ad30e695d0dca8 *R/drapecol.R
+69b924d8e95b23570f677c5169a7c392 *R/emptyplot.R
+a9119bef8f5456282593636f3da8f552 *R/femmecol.R
+b1cdb5dec7fee8075bf4537d5810857e *R/filledcircle.R
+9f0c38750bf4dec187607db44f0fe7e9 *R/filledcylinder.R
+7b22f742681e2f27a0adbc3ff2b2ed5a *R/filledellipse.R
+cc9e953d67b2f9a24c4986cdaa1e1650 *R/filledmultigonal.R
+792cb725ab8626004dc1f0c5c22bc4a3 *R/filledrectangle.R
+e120c4c090fec28865da66c0c1d378e8 *R/filledshape.R
+d7fb0d2b1ecfd3962bf1ce294a2fc438 *R/getellipse.R
+90ba098c71746a06248b8a0bba1ddf89 *R/greycol.R
+8ea268612f5c935671daabde4675340a *R/intpalette.R
+bbb1a668cd759bd3c8a5fc38c1f539b7 *R/plotcircle.R
+cdff36e2ae2a614fb32069095e61cd5d *R/plotellipse.R
+e61b5d2dddeea1f0b140d46792485d86 *R/rotatexy.R
+02519b67f7b727abed90fea06615c350 *R/roundrect.R
+3cdf644d40f404d6534a8774367991ae *R/shadepalette.R
+74bc7ca165e5b6d0893af9ea6d336393 *R/shape.R
+e16b25fc0b92a4b4cccba50d807ac42d *R/textflag.R
+c4acb2c455c83208ba03c9f2f2a3c495 *R/writelabel.R
+543edfb21c08f5ede4ff8d47b248392f *build/vignette.rds
+6f82ba13a638ebf4457960bbf1970667 *demo/00Index
+0520bb297e5ed022fe7dd43778e45030 *demo/colorshapes.r
+0c6605dd0291458541bc2109fa89a142 *inst/doc/shape.R
+109efb168e2ca7f67f296d744230e9d9 *inst/doc/shape.Rnw
+7680a1ec321757075cd8752cf5c9deee *inst/doc/shape.pdf
+65c606d6c046b949c8c8503d395c9c3f *man/A4.Rd
+b5ad212b50734649257fd646855dfa89 *man/Arrowhead.Rd
+e95600c3fd319838832d6680f88dcafd *man/Arrows.Rd
+c679a2cb84f9360ebb47ccb0ffc4ee32 *man/colorlegend.Rd
+7c53d8bec72617700b4b343d56b64ffd *man/cylindersegment.Rd
+59b3beea3ac217b145a63d5bf56ae572 *man/drapecol.Rd
+3eaa6f9c4a198aa80f26ac19d2889bec *man/emptyplot.Rd
+6972de7303cdc61f02ebe317ab2e4814 *man/femmecol.Rd
+668715e38707df7be94b30c189bc6eea *man/filledcircle.Rd
+b8ffe6b96eac330bda780e8dcbbc5138 *man/filledcylinder.Rd
+7e0e289ec66ba3f416460a62a9ed4cbc *man/filledellipse.Rd
+95396f894bf77a4630929c2f19223024 *man/filledmultigonal.Rd
+7605cc653c007ae6a2d91f410a121638 *man/filledrectangle.Rd
+261a2c6aada6a220f4e47372a0ac8d96 *man/filledshape.Rd
+74c7da848cc332385883a5fe97372573 *man/getellipse.Rd
+e63c127fbe48548ac90e3dfa70697696 *man/greycol.Rd
+ff392cd16b8bff84b42d27dc8ea7031c *man/intpalette.Rd
+8a469a9d467c52013217cc39ff526d2e *man/plotcircle.Rd
+070efee7f493c364dad0bfc3b2df4986 *man/plotellipse.Rd
+16fedbe4ec8a06512b606740f2f593ba *man/rotatexy.Rd
+b6c110976b0fa8daca4fa3b5b8484999 *man/roundrect.Rd
+2eee284ebc38eceb7d65e35dc9f03fbe *man/shadepalette.Rd
+d9dd5460e4d62b6f9741c398c0f38f37 *man/shape.Rd
+369b2f6e5a5de72588f889e530b3e284 *man/textflag.Rd
+7f224f822e40fe3759fcab1e0808a8a3 *man/writelabel.Rd
+109efb168e2ca7f67f296d744230e9d9 *vignettes/shape.Rnw
+f03299f196c920a2665f157c5e11f706 *vignettes/vignettes.bib
diff --git a/NAMESPACE b/NAMESPACE
new file mode 100644
index 0000000..4574b7e
--- /dev/null
+++ b/NAMESPACE
@@ -0,0 +1,2 @@
+export(A4, Arrowhead, Arrows, colorlegend, cylindersegment, drapecol, emptyplot, femmecol, filledcircle, filledcylinder, filledellipse, filledmultigonal, filledrectangle, filledshape, getellipse, graycol, greycol, intpalette, plotcircle, plotellipse, rotatexy, roundrect, shadepalette, writelabel, textflag)
+
diff --git a/R/A4.R b/R/A4.R
new file mode 100644
index 0000000..1a7f0a7
--- /dev/null
+++ b/R/A4.R
@@ -0,0 +1,11 @@
+
+##==============================================================================
+## A4 : Opens a window , A4 size
+##==============================================================================
+
+A4 <- function(...) {
+
+ dev.new(width = 8.5, height = 11, ...)
+
+}
+
diff --git a/R/Arrowhead.R b/R/Arrowhead.R
new file mode 100644
index 0000000..3303599
--- /dev/null
+++ b/R/Arrowhead.R
@@ -0,0 +1,90 @@
+
+##==============================================================================
+## Arrowhead : draws arrowhead, various shapes
+##==============================================================================
+
+Arrowhead <- function(x0, y0, angle=0, arr.length=0.4,
+ arr.width=arr.length/2, arr.adj=0.5, arr.type="curved",
+ lcol="black", lty=1, arr.col=lcol, arr.lwd = 2, npoint = 5) {
+
+ ## points of polygon, as drawn in graph with x- and y- ranges -5,5
+
+ if ( arr.type=="curved") { # composed as section of circels
+
+ rad <- 0.7 # radius of outer circles
+ len <- 0.25*pi
+ mid <- c(0,rad)
+
+ x <- seq(1.5*pi+len,1.5*pi,length.out=npoint)
+ rr <- cbind(mid[1]-rad*cos(x),mid[2]+rad*sin(x)) #part of circle
+ mid <- c(0,-rad)
+ x <- rev(x)
+ rr <- rbind(rr,cbind(mid[1]-rad*cos(x),mid[2]-rad*sin(x)))
+ mid <-c(rr[nrow(rr),1],0)
+ rd <-rr[1,2]
+ x <-seq(pi/2,3*pi/2,length.out=3*npoint) #part of ellipse
+ rr <- rbind(rr,cbind(mid[1]-rd*0.25*cos(x),mid[2]-rd*sin(x)))
+ rr[,1] <- rr[,1]*2.6
+ rr[,2] <- rr[,2]*3.45
+ } else
+
+ if (arr.type=="triangle") {
+ x <- c(-0.2,0.0,-0.2)
+ y <- c(-0.1,0.0,0.1)
+ rr <- 6.22*cbind(x,y)
+ } else
+
+ if (arr.type %in% c("circle","ellipse") ) {
+
+ if (arr.type=="circle")
+ arr.width=arr.length
+ rad <- 0.1 # radius of circle
+ mid <- c(-rad,0)
+ x<- seq(0,2*pi,length.out=15*npoint)
+ rr <- 6.22*cbind(mid[1]+rad*sin(x),mid[2]+rad*cos(x))
+ }
+
+ if(arr.adj == 0.5)
+ rr[,1] <- rr[,1]-min(rr[,1])/2
+ if(arr.adj == 0)
+ rr[,1] <- rr[,1]-min(rr[,1])
+
+ user <- par("usr")
+ pcm <- par("pin")*2.54
+
+ sy<- (user[4]-user[3])/pcm[2]
+ sx<- (user[2]-user[1])/pcm[1]
+ nr <- max(length(x0),length(y0),length(angle),
+ length(arr.length),length(arr.width),
+ length(lcol),length(lty),length(arr.col))
+ if (nr>1) {
+ x0 <- rep(x0 ,length.out=nr)
+ y0 <- rep(y0 ,length.out=nr)
+ angle <- rep(angle ,length.out=nr)
+ arr.length <- rep(arr.length,length.out=nr)
+ arr.width <- rep(arr.width,length.out=nr)
+ lcol <- rep(lcol ,length.out=nr)
+ lty <- rep(lty ,length.out=nr)
+ arr.col <- rep(arr.col ,length.out=nr)
+ }
+ RR<-rr
+ for (i in 1:nr) {
+ ## rotation around midpoint
+ dx <- rr[,1]*arr.length [i]
+ dy <- rr[,2]*arr.width [i]
+
+ angpi <- angle[i] / 180 *pi
+ cosa <-cos(angpi)
+ sina <-sin(angpi)
+
+ RR[,1]<- cosa*dx-sina*dy
+ RR[,2]<- sina*dx+cosa*dy
+
+## rescaling and transposing
+ RR[,1]<- x0[i] +RR[,1]*sx
+ RR[,2]<- y0[i] +RR[,2]*sy
+
+## drawing...
+ polygon(RR,col=arr.col[i],border=lcol[i],lty=lty[i],lwd=arr.lwd)
+ }
+}
diff --git a/R/Arrows.R b/R/Arrows.R
new file mode 100644
index 0000000..7ab7c10
--- /dev/null
+++ b/R/Arrows.R
@@ -0,0 +1,58 @@
+
+##==============================================================================
+## Arrows : draws arrow with improved arrowhead
+##==============================================================================
+
+Arrows <- function(x0, y0, x1, y1, code=2,
+ arr.length=0.4, arr.width=arr.length/2, arr.adj=0.5,
+ arr.type="curved", segment=TRUE, col="black", lcol=col, lty=1,
+ arr.col=lcol, lwd = 1, arr.lwd = lwd, ...) {
+
+ if (arr.type=="simple") {
+ arrows(x0,y0,x1,y1,code=code,length=arr.length/2.54,
+ lty=lty, col=col, lwd=lwd, ...)
+ return()
+ }
+ if (arr.type=="T") {
+ arrows(x0,y0,x1,y1,code=code,length=arr.length/(2*2.54),
+ lty=lty, angle=90, col=col, lwd=lwd, ...)
+ return()
+ }
+
+ ## draw segment
+ if (segment) # version 1.4: added lwd
+ segments(x0,y0,x1,y1,col=lcol,lty=lty,lwd=lwd,...)
+
+ ## scaling factor
+ user<-par("usr")
+ pin <-par("pin")
+ pin <- pin/max(pin)
+ sy<- (user[4]-user[3]) /pin[2]
+ sx<- (user[2]-user[1]) /pin[1]
+
+ ## code = 2
+ angle<- atan((y1-y0) /(x1-x0) *sx/sy)/pi*180
+ angle[is.nan(angle)]<-0
+ angle [x1<x0] <-180+angle[x1<x0]
+ xx<-x1
+ yy<-y1
+
+ ## code =3 draws two arrowheads
+ if (code == 3)
+ Arrowhead(x0=xx,y0=yy,angle=angle,
+ lcol=lcol,arr.col=arr.col,arr.adj=arr.adj,
+ lty=lty,arr.length=arr.length,arr.width=arr.width,
+ arr.type=arr.type,arr.lwd=arr.lwd)
+
+ if (code != 2) {
+ angle <-180 + angle
+ xx<-x0
+ yy<-y0
+ }
+
+ Arrowhead(x0=xx,y0=yy,angle=angle,lcol=lcol,arr.col=arr.col,
+ arr.adj=arr.adj,lty=lty,arr.length=arr.length,
+ arr.width=arr.width,arr.type=arr.type,arr.lwd=arr.lwd)
+}
+
+
diff --git a/R/colorlegend.R b/R/colorlegend.R
new file mode 100644
index 0000000..dfd6417
--- /dev/null
+++ b/R/colorlegend.R
@@ -0,0 +1,91 @@
+##==============================================================================
+## colorlegend : adds a color legend to a plot
+##==============================================================================
+
+colorlegend <- function(col=femmecol(100), zlim, zlevels=5,
+ dz=NULL, zval=NULL, log=FALSE, posx=c(0.9,0.93), posy=c(0.05,0.9),
+ main=NULL, main.cex=1.0, main.col="black", lab.col="black",
+ digit=0, left=FALSE, ...) {
+
+ ncol <- length (col)
+ par (new=TRUE)
+ omar <- nmar <- par("mar")
+ nmar[c(2,4)]<-0
+ par (mar = nmar)
+
+ emptyplot()
+ pars <- par("usr")
+
+ ## Rectangle positions on x and y-axis
+ dx <- pars[2]-pars[1]
+ xmin <- pars[1]+posx[1]*dx
+ xmax <- pars[1]+posx[2]*dx
+
+ dy <- pars[4]-pars[3]
+ ymin <- pars[3]+posy[1]*dy
+ ymax <- pars[3]+posy[2]*dy
+
+ ## z-values
+ if (!is.null(zval)) {
+ zz<-zval
+ dz<-NULL
+ }
+
+ if (is.null(dz)&is.null(zval))
+ if (! is.null(zlevels)) {
+ if (log) {
+ zz <- 10^(pretty(log10(zlim),n=(zlevels+1)))
+ } else
+ zz <- pretty(zlim,n=(zlevels+1))
+ } else zz <- NULL
+ if (!is.null(dz)) {
+ if (log)
+ zz <- 10^(seq(log10(zlim[1]),log10(zlim[2]),by=dz))
+ if (!log)
+ zz <- seq(zlim[1],zlim[2],by=dz)
+ }
+
+ if (log) {
+ zlim <- log10(zlim)
+ if (! is.null(zz))
+ zz <- log10(zz)
+ }
+
+ zmin <- zlim[1]
+ zmax <- zlim[2]
+
+ ## colors
+ Y <- seq(ymin,ymax,length.out=ncol+1)
+ rect(xmin,Y[-(ncol+1)],xmax,Y[-1],col=col,border=NA)
+ rect(xmin,ymin,xmax,ymax,border=lab.col)
+
+ if (! is.null(zz)) {
+ ## labels
+ dx <- (xmax-xmin)
+ dy <- (ymax-ymin)
+
+ if (left) {
+ Dx <- -dx # labels on left..
+ pos <- 2
+ xpos <- xmin+Dx*0.5
+ } else {
+ Dx <- +dx # labels on right..
+ pos <- 4
+ xpos <- xmax+Dx*0.5
+ }
+
+ Ypos <- ymin+(zz-zmin)/(zmax-zmin)*dy
+ segments(xmin,Ypos,xmax,Ypos,col=lab.col)
+ segments(xpos+Dx*0.25,Ypos,xmin,Ypos,col=lab.col)
+ text (xpos,Ypos,formatC(zz,digits=digit,format="f"),pos=pos,col=lab.col,...)
+ }
+
+ if (!is.null(main)) {
+ for (i in length(main):1)
+ text (x=mean(c(xmin,xmax)),y=ymax+0.05*(length(main)-i+1),
+ labels=main[i],adj=c(0.5,0.5),cex=main.cex,col=main.col)
+ }
+ par (new=FALSE)
+ par (mar=omar)
+
+}
diff --git a/R/cylindersegment.R b/R/cylindersegment.R
new file mode 100644
index 0000000..c658374
--- /dev/null
+++ b/R/cylindersegment.R
@@ -0,0 +1,41 @@
+##==============================================================================
+## cylindersegment : plots (part of) a cylinder
+##==============================================================================
+
+
+cylindersegment <- function (rx=1, ry=rx, from=pi, to=3*pi/2,
+ len=1, mid=c(0,0), angle=0, dr=0.01, col="black", delt =1.0, ...) {
+
+ base1 <- mid ; base1[1]<-mid[1]-len/2
+ base2 <- mid ; base2[1]<-mid[1]+len/2
+
+ if (from >to) {
+ a <- from
+ from <- to
+ to <- a
+ }
+
+ x <- c( seq(from,to,by=dr), to)
+ ex <- base1[1] + rx * cos(x)
+ ey <- base1[2] + ry * sin(x)
+
+ if (angle != 0) {
+ xy <- rotatexy (cbind (ex,ey) , angle=angle, mid=mid)
+ ex <- xy[,1];ey <- xy[,2]
+ }
+
+ x<-rev(x)
+ x2 <- base2[1] + rx * cos(x) * delt
+ y2 <- base2[2] + ry * sin(x) * delt
+
+ if (angle != 0) {
+ xy <- rotatexy ( cbind(x2,y2), angle=angle, mid=mid)
+ x2 <- xy[,1];y2 <- xy[,2]
+ }
+
+ ex <- c(ex, x2)
+ ey <- c(ey, y2)
+
+ polygon(ex, ey, col=col, border=col, ...)
+
+} # end cylindersegment
diff --git a/R/drapecol.R b/R/drapecol.R
new file mode 100644
index 0000000..fe01bee
--- /dev/null
+++ b/R/drapecol.R
@@ -0,0 +1,30 @@
+
+##==============================================================================
+## drapecol: colors for draping persp (surface) plots
+##==============================================================================
+
+drapecol <- function(A, col=femmecol(100), NAcol = "white", lim = NULL) {
+
+ nr <- nrow(A) ; nc <- ncol(A) ; ncol <- length(col)
+
+ ## drape color matrix has one row and one column less than input matrix;
+ ## take a weighted average
+ AA <- 0.25 * (A[1:(nr-1),1:(nc-1)] +
+ A[1:(nr-1),2:nc] +
+ A[2:nr,1:(nc-1)] +
+ A[2:nr,2:nc])
+
+ if (! is.null(lim)) Ar <- lim
+ else Ar <- range(AA, na.rm=TRUE)
+ rn <- Ar[2] - Ar[1]
+
+ ifelse (rn != 0, drape <- col[1+trunc((AA-Ar[1])/rn*(ncol-1))] ,
+ drape <- rep(col[1],ncol) )
+
+ drape [is.na(drape)] <- NAcol
+
+ return(drape)
+
+}
+
+
diff --git a/R/emptyplot.R b/R/emptyplot.R
new file mode 100644
index 0000000..2a946b6
--- /dev/null
+++ b/R/emptyplot.R
@@ -0,0 +1,16 @@
+
+##==============================================================================
+## emptyplot: open plot region for shape plotting
+##==============================================================================
+
+emptyplot <- function (xlim=c(0,1), ylim=xlim, asp=1,
+ frame.plot = FALSE, col=NULL, ...) {
+
+ plot(0, type = "n", xlab="", ylab = "", asp=asp, axes=FALSE,
+ frame.plot = frame.plot,
+ xlim = xlim, ylim = ylim, xaxs="i", yaxs="i", ...)
+
+ if ( ! is.null(col) )
+ rect(xlim[1], ylim[1], xlim[2], ylim[2], col=col)
+
+}
diff --git a/R/femmecol.R b/R/femmecol.R
new file mode 100644
index 0000000..8a1ba88
--- /dev/null
+++ b/R/femmecol.R
@@ -0,0 +1,21 @@
+
+##==============================================================================
+## femmecol: red-yellow-blue colors
+##==============================================================================
+
+femmecol <- function (n=100) {
+
+ ## red-green-blue colors on scale of 0 to 1
+ rgb.col <- matrix(nrow=6,ncol=3,byrow=TRUE,
+ data=c(0,0,143,
+ 0,0,255,
+ 0,255,255,
+ 255,255,0,
+ 255,0,0,
+ 128,0,0))
+
+ x.from <- c(0.0, seq(0.125,1,by=0.25), 1) # scale from 0-1
+
+ return(intpalette (rgb.col, n, x.from = x.from) )
+
+}
diff --git a/R/filledcircle.R b/R/filledcircle.R
new file mode 100644
index 0000000..3c1e8fc
--- /dev/null
+++ b/R/filledcircle.R
@@ -0,0 +1,18 @@
+
+##==============================================================================
+## filledcircle : draws and colors circle; colors depend on radius
+##==============================================================================
+
+filledcircle <- function(r1=1, r2=0, mid=c(0,0), dr=0.01,
+ from=-pi, to=pi, col=femmecol(100), values=NULL, zlim=NULL,
+ lwd=2, lcol=NA, ...) {
+
+ user <- par("usr") # to maintain the aspect ratio...
+ pin <- par("pin")
+ sy <- user[4]-user[3]
+ sx <- user[2]-user[1]
+ ry1 <- r1*sy/sx*pin[1]/pin[2]
+ ry2 <- r2*sy/sx*pin[1]/pin[2]
+ filledellipse(rx1=r1,ry1=ry1,rx2=r2,ry2=ry2,mid=mid,dr=dr,from=from,to=to,
+ col=col,lwd=lwd,lcol=lcol,values=values,zlim=zlim,...)
+}
diff --git a/R/filledcylinder.R b/R/filledcylinder.R
new file mode 100644
index 0000000..a4576e6
--- /dev/null
+++ b/R/filledcylinder.R
@@ -0,0 +1,71 @@
+
+##==============================================================================
+## filledcylinder : draws and colors cylinder colors depend on radius
+##==============================================================================
+
+filledcylinder <- function(rx=1, ry=rx, len=1,
+ col=femmecol(100), lcol=NA, lwd=2, lcolint=NULL,
+ ltyint=1, lwdint=lwd, mid=c(0,0), angle=0, delt =1.0,
+ dr=0.01, topcol=NULL, botcol=NULL, ...) {
+
+ rx <- max(1e-6,rx) # avoid NANs
+ ncol <- length (col)
+
+ if (ncol > 0) {
+ intrad <- seq(pi/2,3*pi/2,length.out=ncol+1)
+ Col <- col
+ nval <- ncol
+
+ ## main body of cylinder
+ for (i in 1:nval) {
+ from <- intrad[i+1]
+ to <- intrad [i]
+
+ cylindersegment (rx=rx,ry=ry,from=from,to=to, len=len,
+ mid=mid,dr=dr,angle=angle,
+ col=Col[i],delt=delt)
+ }
+ }
+
+ base2 <- mid +c(len/2,0)
+ if (angle != 0)
+ base2 <- rotatexy(base2, angle=angle, mid=mid)
+
+ base1 <- mid + c(-len/2,0)
+ if (angle != 0)
+ base1 <- rotatexy(base1, angle=angle, mid=mid)
+
+ ## color of top
+ if(! is.null (topcol))
+ filledellipse( rx1=rx*delt, ry1=ry*delt, col=topcol, mid=base2,
+ angle=angle, dr=dr, ...)
+
+ if (! is.null(botcol))
+ filledellipse( rx1=rx, ry1=ry, col=botcol, mid=base1,
+ angle=angle, dr=dr, ...)
+
+
+ if (! is.na(lcol)) {
+ l1 <- rotatexy( getellipse( rx, ry, mid=mid+c(-len/2,0), dr=dr,
+ from=pi/2, to=3*pi/2), angle=angle, mid)
+ l2 <- rotatexy( getellipse( rx*delt, ry*delt, mid=mid+c(len/2,0),dr=dr),
+ angle=angle, mid)
+
+ lines(l1,col=lcol,lwd=lwd)
+ lines(l2,col=lcol,lwd=lwd)
+ if (! is.null(lcolint)) {
+ l1 <- rotatexy(getellipse( rx, ry, mid=mid+c(-len/2,0), dr=dr,
+ from=-pi/2, to=pi/2), angle=angle, mid)
+ lines(l1, col=lcolint, lwd=lwdint, lty=ltyint)
+ }
+
+ l1 <- rotatexy( rbind( mid+c(len/2, ry*delt), mid+c(-len/2,ry)),
+ angle, mid)
+ l2 <- rotatexy( rbind( mid+c(len/2, -ry*delt), mid+c(-len/2,-ry)),
+ angle, mid)
+ lines(l1,col=lcol,lwd=lwd)
+ lines(l2,col=lcol,lwd=lwd)
+ }
+
+}
+
diff --git a/R/filledellipse.R b/R/filledellipse.R
new file mode 100644
index 0000000..36e4828
--- /dev/null
+++ b/R/filledellipse.R
@@ -0,0 +1,27 @@
+
+##==============================================================================
+## filledellipse : draws and colors ellipse; colors depend on radius
+##==============================================================================
+
+filledellipse <- function(rx1=1, rx2=0, ry1=rx1, ry2=NULL,
+ mid=c(0,0), dr=0.01, angle=0, from=-pi, to=pi,
+ col=femmecol(100), values=NULL, zlim=NULL, lwd=2, lcol=NA, ...) {
+
+ ncol <- length (col)
+ if (is.null (ry2))
+ ry2 <- ry1*rx2/rx1 # same proportionality as long radius
+
+ ## outer ellipse
+ xyouter <- getellipse(rx=rx1, ry=ry1, mid=mid, dr=dr,
+ angle=angle, from=from, to=to)
+
+ ## inner ellipse
+ if (rx2==0)
+ xyinner <- mid else {
+ xyinner <- getellipse(rx=rx2, ry=ry2, mid=mid, dr=dr, angle=angle,
+ from=from, to=to)
+ }
+ filledshape(xyouter=xyouter, xyinner=xyinner, col=col, values=values,
+ zlim=zlim, lwd=lwd, lcol=lcol, ...)
+
+}
diff --git a/R/filledmultigonal.R b/R/filledmultigonal.R
new file mode 100644
index 0000000..3451f0a
--- /dev/null
+++ b/R/filledmultigonal.R
@@ -0,0 +1,18 @@
+
+##==============================================================================
+## filledmultigonal : draws and colors shape with equal-sized vertices
+## color can be palette
+##==============================================================================
+
+filledmultigonal <- function(mid=c(0,0), rx=1, ry=rx, nr=4,
+ col=femmecol(100), values=NULL, zlim=NULL, lwd=2, lcol=NA,
+ angle = 0, ...) {
+
+ xy <- getellipse(mid=mid,rx=rx,ry=ry,dr=2*pi/nr,from=0,to=2*pi)
+ if (angle != 0)
+ xy <- rotatexy (xy,angle=angle,mid=mid) # rotate around mid
+
+ filledshape(xyouter=xy, xyinner=mid, col=col, values=values,
+ zlim=zlim, lwd=lwd, lcol=lcol, ...)
+
+}
diff --git a/R/filledrectangle.R b/R/filledrectangle.R
new file mode 100644
index 0000000..bca7cf7
--- /dev/null
+++ b/R/filledrectangle.R
@@ -0,0 +1,43 @@
+
+##==============================================================================
+## filledrectangle : draws and colors rectangle color can be palette
+##==============================================================================
+
+filledrectangle <- function(mid=c(0,0), wx=1, wy=wx,
+ col=femmecol(100), values=NULL, zlim=NULL,
+ lwd=2, lcol=NA, angle = 0, ...) {
+
+ vv <- val2col(values,zlim,col)
+ intrad <- vv$intrad
+ Col <- vv$Col
+
+ ncol <- length (Col)
+
+ for (i in 1:ncol) {
+ x1 <- mid[1] - wx/2
+ x2 <- mid[1] + wx/2
+
+ y1 <- mid[2] - wy/2 +wy*intrad[i]
+ y2 <- mid[2] - wy/2 +wy*intrad[i+1]
+ xy <- cbind(c(x1,x1,x2,x2),c(y1,y2,y2,y1))
+
+ if (angle != 0)
+ xy <- rotatexy (xy,angle=angle,mid=mid) # rotate around mid
+ polygon(xy[,1],xy[,2],col=Col[i],border=Col[i], ...)
+
+ }
+
+ if (!is.na(lcol)) {
+ x1 <- mid[1] - wx/2
+ x2 <- mid[1] + wx/2
+
+ y1 <- mid[2] - wy/2
+ y2 <- mid[2] + wy/2
+ xy <- cbind(c(x1,x1,x2,x2),c(y1,y2,y2,y1))
+
+ if (angle != 0)
+ xy <- rotatexy (xy,angle=angle,mid=mid)
+
+ polygon(xy[,1],xy[,2],border=lcol,col=NA, ...)
+ }
+}
diff --git a/R/filledshape.R b/R/filledshape.R
new file mode 100644
index 0000000..396377b
--- /dev/null
+++ b/R/filledshape.R
@@ -0,0 +1,70 @@
+##==============================================================================
+## filledshape : draws and colors a shape color depend on radius
+##==============================================================================
+
+filledshape <- function(xyouter, xyinner=colMeans(xyouter),
+ col=femmecol(100), values=NULL, zlim=NULL, lcol=NA, lwd=2, ...) {
+
+
+ expand<-function(mat,npoints) {
+ mat <- matrix(ncol=2,mat)
+ nfrom <- nrow(mat)
+ nin <- round(npoints/nfrom)
+ nin <- rep(nin,nfrom-1)
+ nin <- c(nin,npoints-sum(nin))
+ mat <-rbind(mat,mat[1,])
+ out <- NULL
+ for (i in 1:nfrom) {
+ x <- approx(x=mat[c(i,i+1),1],n=nin[i])$y
+ y <- approx(x=mat[c(i,i+1),2],n=nin[i])$y
+ out <- rbind(out,cbind(x,y) )
+ }
+ out
+ }
+
+ vv <- val2col(values,zlim,col)
+ intrad <- vv$intrad
+ Col <- vv$Col
+ nrad <- vv$nrad
+
+ ## check inner and outer points
+ npoint <- nrow(xyouter)
+ nmid <- length(xyinner)/2
+ middle <- xyinner
+ extern <- xyouter
+
+ if ( nrad == 1 & nmid == 1) {
+ polygon(xyouter[,1],xyouter[,2],col=Col,border=Col,...)
+ } else if (nrad==1) {
+ if (nmid < npoint)
+ for (i in (nmid+1):npoint)
+ middle <- rbind(middle ,xyinner)
+ polygon(c(xyouter[,1], rev(middle[,1])), c(xyouter[,2], rev(middle[,2])),
+ col=Col, border=Col, ...)
+
+ } else {
+ if (nmid < npoint)
+ middle <- expand(middle,npoint)
+ if (nmid > npoint)
+ extern <- expand(extern,nmid )
+ ## start coloration
+ inner <- middle
+
+ for (i in 1:nrad) {
+ relrad <- intrad[i+1]
+ outer <- inner
+ inner[,1] <- middle [,1] + relrad * (extern[,1]-middle[,1])
+ inner[,2] <- middle [,2] + relrad * (extern[,2]-middle[,2])
+ polygon(c(outer[,1], rev(inner[,1])), c(outer[,2], rev(inner[,2])),
+ col=Col[i], border=Col[i], ...)
+ }
+ }
+
+ if (! is.na(lcol)) {
+ lines(xyouter,lwd=lwd,col=lcol)
+ if (length(xyinner)>2)
+ lines(xyinner,lwd=lwd,col=lcol)
+ }
+
+} # of filledshape
+
diff --git a/R/getellipse.R b/R/getellipse.R
new file mode 100644
index 0000000..9f52745
--- /dev/null
+++ b/R/getellipse.R
@@ -0,0 +1,19 @@
+
+##==============================================================================
+## getellipse : calculates the x-y values for (part of) an ellipse
+##==============================================================================
+
+getellipse <- function (rx=1, ry=rx, mid=c(0,0), dr=0.01,
+ angle=0, from=-pi, to=pi) {
+
+ dr <- abs(dr)
+ if (to < from) to <- 2*pi + to
+ x <- c( seq(from,to,by=dr), to)
+ if (x[length(x)] == x[length(x)-1])
+ x <- x[-length(x)]
+ xy <- cbind( mid[1] + rx * cos(x), mid[2] + ry * sin(x))
+
+ if (angle != 0)
+ xy <- rotatexy (xy, angle=angle, mid=mid) # rotate around mid
+ return(xy)
+}
diff --git a/R/greycol.R b/R/greycol.R
new file mode 100644
index 0000000..e44cc26
--- /dev/null
+++ b/R/greycol.R
@@ -0,0 +1,14 @@
+
+##==============================================================================
+## greycol: black-white colors
+##==============================================================================
+
+greycol <- function (n=100, interval = c(0.0,0.7)) {
+
+ return(shadepalette (n=n, inicol="white", endcol="black", interval=interval))
+}
+
+# alias for greycol...
+graycol <- function (n=100, # number of colors
+ interval = c(0.0,0.7)) # interval *to* where to interpolate
+ return(shadepalette(n=n,inicol="white",endcol="black",interval=interval))
diff --git a/R/intpalette.R b/R/intpalette.R
new file mode 100644
index 0000000..a3d8fca
--- /dev/null
+++ b/R/intpalette.R
@@ -0,0 +1,30 @@
+##==============================================================================
+## intpalette : interpolates a palette
+##==============================================================================
+
+intpalette <- function(inputcol, numcol=length(x.to), x.from= NULL,
+ x.to = NULL) {
+
+ if (length(inputcol)<=1)
+ return(rep(inputcol,numcol))
+ ifelse (is.numeric(inputcol),
+ rgb.col <- inputcol, rgb.col<-t(col2rgb(c(inputcol))) )
+ if (is.null(x.from))
+ x.from <- seq (0,1,length.out=nrow(rgb.col))
+ if (is.null(x.to ))
+ x.to <- seq (0,1,length.out=numcol)
+
+ if (min(x.to) < min(x.from) | max(x.to) > max(x.from))
+ stop ("intpalette: cannot interpolate; ranges x.to > ranges x.from")
+
+ outcol <- matrix(ncol=3,nrow=numcol)
+ for (i in 1:3)
+ outcol[,i] <- round(approx(x.from,rgb.col[,i],xout=x.to)$y)
+
+ outcol[outcol<0] <- 0
+ outcol[outcol>255] <- 0
+ color <- rgb(outcol[,1],outcol[,2],outcol[,3],maxColorValue = 255)
+
+ return(color)
+
+}
diff --git a/R/plotcircle.R b/R/plotcircle.R
new file mode 100644
index 0000000..db6ea8a
--- /dev/null
+++ b/R/plotcircle.R
@@ -0,0 +1,15 @@
+
+##==============================================================================
+## plotcircle : plots (part of) a circle
+##==============================================================================
+
+plotcircle <- function (r=1, ...) {
+
+ user <- par("usr")
+ pin <- par("pin")
+ sy <- user[4] - user[3]
+ sx <- user[2] - user[1]
+ ry <- r * sy / sx * pin[1] / pin[2]
+
+ plotellipse(rx=r, ry=ry, ... )
+}
diff --git a/R/plotellipse.R b/R/plotellipse.R
new file mode 100644
index 0000000..1139338
--- /dev/null
+++ b/R/plotellipse.R
@@ -0,0 +1,40 @@
+
+##==============================================================================
+## plotellipse : plots (part of) an ellipse
+##==============================================================================
+
+plotellipse <- function (rx=1, ry=0.2, mid=c(0,0), dr=0.01,
+ angle=0, from=-pi, to=pi, type="l", lwd=2, lcol="black",
+ col=NULL, arrow=FALSE, arr.length=0.4, arr.width=arr.length*0.5,
+ arr.type="curved", arr.pos=1, arr.code=2, arr.adj=0.5,
+ arr.col="black", ...) {
+
+
+ xy<-getellipse (rx,ry,mid,angle=angle,dr=dr,from=from,to=to)
+
+ if (! is.null(col))
+ polygon(xy,col=col,border=NA)
+ if (type != "n" )
+ lines(xy,type=type,lwd=lwd,col=lcol,...)
+ nr <- nrow(xy)
+
+ if (arrow) {
+ ilen <- length(arr.pos)
+ if (ilen>1) {
+ arr.code <- rep(arr.code ,length.out=ilen)
+ arr.col <- rep(arr.col ,length.out=ilen)
+ arr.length<- rep(arr.length,length.out=ilen)
+ arr.width <- rep(arr.width ,length.out=ilen)
+ arr.type <- rep(arr.type ,length.out=ilen)
+ arr.adj <- rep(arr.adj ,length.out=ilen)
+ }
+
+ for (i in 1: ilen) {
+ ii <- max(2,trunc(nr*arr.pos[i]))
+ Arrows(xy[ii-1,1], xy[ii-1,2], xy[ii,1], xy[ii,2],
+ lcol=arr.col[i], code=arr.code[i], arr.col=arr.col[i],
+ arr.length =arr.length[i], arr.width=arr.width[i],
+ arr.type=arr.type[i], arr.adj=arr.adj[i])
+ }
+ }
+}
diff --git a/R/rotatexy.R b/R/rotatexy.R
new file mode 100644
index 0000000..0a5fa8e
--- /dev/null
+++ b/R/rotatexy.R
@@ -0,0 +1,29 @@
+
+##==============================================================================
+## ROTATIONS...
+## rotatexy : rotates xy values around midpoint
+##==============================================================================
+
+rotatexy <- function (xy, angle, mid=colMeans(xy), asp=FALSE) {
+
+ xy <- matrix(ncol=2,data=xy)
+ angpi <- angle / 180 *pi
+ cosa <-cos(angpi)
+ sina <-sin(angpi)
+
+ dx <- xy[,1] - mid[1]
+ dy <- xy[,2] - mid[2]
+
+ ex <-mid[1] + cosa*dx-sina*dy
+ ey <-mid[2] + sina*dx+cosa*dy
+
+ if (asp) {
+ user <- par("usr")
+ pin <- par("pin")
+ sy <- user[4]-user[3]
+ sx <- user[2]-user[1]
+ ey <- mid[2] + (ey -mid[2])*sy/sx*pin[1]/pin[2]
+ }
+
+ return(cbind(ex,ey))
+}
diff --git a/R/roundrect.R b/R/roundrect.R
new file mode 100644
index 0000000..4ed200d
--- /dev/null
+++ b/R/roundrect.R
@@ -0,0 +1,21 @@
+
+##==============================================================================
+## roundrect: rectangular box with rounded left and right edges
+##==============================================================================
+
+roundrect<- function(mid, radx, rady, rx=rady, dr=0.01, col="white",
+ lcol="black", lwd=2, angle=0, ...) {
+
+ leftell <- getellipse(ry=rady, rx=rx, mid=c(mid[1]-radx,mid[2]),
+ dr=dr, from=pi/2, to=3/2*pi)
+ rightell <- getellipse(ry=rady, rx=rx, mid=c(mid[1]+radx,mid[2]),
+ dr=dr, from=-pi/2, to=pi/2)
+ xyout <- rbind(leftell, c(mid[1]-radx,mid[2]-rady),
+ c(mid[1]+radx, mid[2]-rady),
+ rightell, c(mid[1]+radx,mid[2]+rady),
+ c(mid[1]-radx, mid[2]+rady) )
+ if (angle != 0)
+ xyout <- rotatexy(xyout, angle=angle)
+ filledshape( xyout, mid, col=col, lcol=lcol, lwd=lwd, ...)
+
+}
diff --git a/R/shadepalette.R b/R/shadepalette.R
new file mode 100644
index 0000000..1a175a5
--- /dev/null
+++ b/R/shadepalette.R
@@ -0,0 +1,12 @@
+
+##==============================================================================
+## shadepalette : creates a palette that is suited for shading
+##==============================================================================
+
+shadepalette <- function(n=100, endcol = "red", inicol = "white",
+ interval = c(0.0,1.0)) {
+
+ x.to <- seq ( interval[1], interval[2], length.out=n)
+ return( intpalette( rbind(inicol,endcol), n, x.to=x.to))
+
+}
diff --git a/R/shape.R b/R/shape.R
new file mode 100644
index 0000000..011917f
--- /dev/null
+++ b/R/shape.R
@@ -0,0 +1,42 @@
+##==============================================================================
+##
+## Spheres/Cylindres/Ellipses/Arrows
+## Karline Soetaert
+##
+##==============================================================================
+
+##==============================================================================
+## INTERNAL FUNCTION
+##==============================================================================
+
+val2col <- function (values,zlim,col) {
+
+ if (! is.null(values)) { # a matrix of radius, z-values
+
+ if (min(values[,1])<0)
+ stop ("cannot draw shape: radiusses in first column of *values* are not positive")
+ values <- values [sort(values[,1],index=TRUE)$ix,] # sort on first column (radiusses)
+
+ if (is.null(zlim)) {
+ zlim<-range(values[,2])
+ } else {
+ values[,2]<-pmin(values[,2],zlim[2])
+ values[,2]<-pmax(values[,2],zlim[1])
+ }
+
+ x.to <- (values[,2]-zlim[1])/(diff(zlim))
+ Col <- intpalette (inputcol=col,x.to = x.to)
+ nrad <- nrow(values)
+ values[,1] <- values[,1]/values[nrad,1]
+ intrad <- c(0,values[,1])
+ } else {
+ Col <- col
+ nrad <- length(Col)
+ intrad <- c(0, 1:nrad)/nrad
+
+ ncol <- length(col)
+ if (ncol < nrad)
+ Col <- intpalette(col, nrad)
+ }
+ return(list(Col=Col,intrad=intrad,nrad=nrad))
+}
diff --git a/R/textflag.R b/R/textflag.R
new file mode 100644
index 0000000..0a69d8a
--- /dev/null
+++ b/R/textflag.R
@@ -0,0 +1,53 @@
+
+textflag <- function(mid, radx, rady, rx = rady, dr = 0.01,
+ col = femmecol(100), lcol = "white",
+ bcol = lcol, # color to remove ellipse
+ lwd = 2, angle = 0, lab = NULL, leftright = TRUE,
+ tcol = NULL, ...) {
+ wx <- rady * 2
+ wy <- radx * 2
+ if (is.null(rx)) rx <- rady
+
+ # rectangle
+ if (leftright)
+ filledrectangle(wx = wx, wy = wy, col = col,
+ mid = mid, angle = angle -90)
+ else
+ filledrectangle(wx = wy, wy = wx, col = col,
+ mid = mid, angle = angle)
+
+ # ellipse left to be cut away
+ leftell <- getellipse(ry = rady, rx = rx, mid = c(mid[1] -
+ radx+rx, mid[2]), dr = dr, from = pi/2, to = 3/2 * pi)
+
+ lx <- range(leftell[, 1])
+ ly <- range(leftell[, 2])
+ LL <- rbind(leftell, c(lx[1], ly[1]), c(lx[1], ly[2]), c(lx[2], ly[2]))
+ if (angle != 0)
+ LL <- rotatexy(LL, angle = angle, mid = mid)
+
+ polygon(LL, col = bcol, border = bcol)
+
+ # ellipse left to be cut away
+ rightell <- getellipse(ry = rady, rx = rx, mid = c(mid[1] +
+ radx-rx, mid[2]), dr = dr, from = -pi/2, to = pi/2)
+
+ lx <- range(rightell[, 1])
+ ly <- range(rightell[, 2])
+ RR <- rbind(rightell, c(lx[2], ly[2]), c(lx[2], ly[1]), c(lx[1], ly[1]))
+ if (angle != 0)
+ RR <- rotatexy(RR, angle = angle, mid = mid)
+
+ polygon(RR, col = bcol, border = bcol)
+
+ # lines
+ Lines <- rbind(leftell,rightell,leftell[1,])
+ if (angle != 0)
+ Lines <- rotatexy(Lines, angle = angle, mid = mid)
+
+ lines(Lines, col = lcol, lwd = lwd)
+ if (! is.null(lab)) text (mid[1], mid[2], lab, srt = angle, col = tcol,
+ ...)
+}
+
+
\ No newline at end of file
diff --git a/R/writelabel.R b/R/writelabel.R
new file mode 100644
index 0000000..49440f6
--- /dev/null
+++ b/R/writelabel.R
@@ -0,0 +1,20 @@
+
+##==============================================================================
+## writelabel : adds a label next to a plot
+##==============================================================================
+
+writelabel <- function (text=NULL, nr=1, at=-0.1, line=1, cex=1.5, ...) {
+
+ if (is.null(text))
+ text <- LETTERS[nr]
+
+ ## scale factors
+ usr <- par("usr")
+ xmin <- usr[1]
+ xmax <- usr[2]
+ xrange <- xmax-xmin
+ pos <- xmin + at * xrange
+
+ mtext ( text=text, at=pos, line=line, cex=cex, ...)
+
+}
diff --git a/build/vignette.rds b/build/vignette.rds
new file mode 100644
index 0000000..310556e
Binary files /dev/null and b/build/vignette.rds differ
diff --git a/debian/README.test b/debian/README.test
deleted file mode 100644
index 55a9142..0000000
--- a/debian/README.test
+++ /dev/null
@@ -1,8 +0,0 @@
-Notes on how this package can be tested.
-────────────────────────────────────────
-
-To run the unit tests provided by the package you can do
-
- sh run-unit-test
-
-in this directory.
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
index 51cb922..0000000
--- a/debian/changelog
+++ /dev/null
@@ -1,5 +0,0 @@
-r-cran-shape (1.4.2-1) unstable; urgency=low
-
- * Initial release (closes: #829585)
-
- -- Andreas Tille <tille at debian.org> Mon, 04 Jul 2016 14:50:52 +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 19f8ada..0000000
--- a/debian/control
+++ /dev/null
@@ -1,20 +0,0 @@
-Source: r-cran-shape
-Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
-Uploaders: Andreas Tille <tille at debian.org>
-Section: gnu-r
-Priority: optional
-Build-Depends: debhelper (>= 9),
- cdbs,
- r-base-dev
-Standards-Version: 3.9.8
-Vcs-Browser: https://anonscm.debian.org/viewvc/debian-med/trunk/packages/R/r-cran-shape/trunk/
-Vcs-Svn: svn://anonscm.debian.org/debian-med/trunk/packages/R/r-cran-shape/trunk/
-Homepage: https://cran.r-project.org/web/packages/shape
-
-Package: r-cran-shape
-Architecture: all
-Depends: ${misc:Depends},
- ${R:Depends}
-Description: GNU R functions for plotting graphical shapes, colors
- This GNU R package provides functions for plotting graphical shapes such
- as ellipses, circles, cylinders, arrows, ...
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644
index 60439b3..0000000
--- a/debian/copyright
+++ /dev/null
@@ -1,26 +0,0 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: shape
-Upstream-Contact: Karline Soetaert <karline.soetaert at nioz.nl>
-Source: https://cran.r-project.org/web/packages/shape
-
-Files: *
-Copyright: 2010-2014 Karline Soetaert <karline.soetaert at nioz.nl>
-License: GPL-3+
-
-Files: debian/*
-Copyright: 2016 Andreas Tille <tille at debian.org>
-License: GPL-3+
-
-License: GPL-3+
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
- .
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- .
- On Debian systems, the complete text of the GNU General Public
- License can be found in `/usr/share/common-licenses/GPL-3'.
diff --git a/debian/docs b/debian/docs
deleted file mode 100644
index 9a4f4f8..0000000
--- a/debian/docs
+++ /dev/null
@@ -1,2 +0,0 @@
-debian/README.test
-debian/tests/run-unit-test
diff --git a/debian/examples b/debian/examples
deleted file mode 100644
index 18244c8..0000000
--- a/debian/examples
+++ /dev/null
@@ -1 +0,0 @@
-vignettes
diff --git a/debian/rules b/debian/rules
deleted file mode 100755
index 2fbba2d..0000000
--- a/debian/rules
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/make -f
-
-include /usr/share/R/debian/r-cran.mk
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/tests/control b/debian/tests/control
deleted file mode 100644
index d2aa55a..0000000
--- a/debian/tests/control
+++ /dev/null
@@ -1,3 +0,0 @@
-Tests: run-unit-test
-Depends: @
-Restrictions: allow-stderr
diff --git a/debian/tests/run-unit-test b/debian/tests/run-unit-test
deleted file mode 100644
index 1296f80..0000000
--- a/debian/tests/run-unit-test
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh -e
-oname=shape
-pkg=r-cran-`echo $oname | tr '[A-Z]' '[a-z]'`
-
-if [ "$ADTTMP" = "" ] ; then
- ADTTMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
- trap "rm -rf $ADTTMP" 0 INT QUIT ABRT PIPE TERM
-fi
-cd $ADTTMP
-cp /usr/share/doc/$pkg/examples/vignettes/* $ADTTMP
-find . -name "*.gz" -exec gunzip \{\} \;
-for rnw in `ls *.[rRS]nw` ; do
-rfile=`echo $rnw | sed 's/\.[rRS]nw/.R/'`
-R --no-save <<EOT
- Stangle("$rnw")
- source("$rfile", echo=TRUE)
-EOT
- echo "$rnw passed"
-done
diff --git a/debian/watch b/debian/watch
deleted file mode 100644
index 00f272f..0000000
--- a/debian/watch
+++ /dev/null
@@ -1,2 +0,0 @@
-version=3
-http://cran.r-project.org/src/contrib/shape_([-\d.]*)\.tar\.gz
diff --git a/demo/00Index b/demo/00Index
new file mode 100644
index 0000000..27b9fb6
--- /dev/null
+++ b/demo/00Index
@@ -0,0 +1 @@
+colorshapes Demonstration of colored shapes, color palettes, in package shape...
diff --git a/demo/colorshapes.r b/demo/colorshapes.r
new file mode 100644
index 0000000..2a0a790
--- /dev/null
+++ b/demo/colorshapes.r
@@ -0,0 +1,334 @@
+# Demo for shapes
+par(ask=TRUE)
+
+##drapecol
+ persp(volcano,theta = 135, phi = 30, col = drapecol(volcano),main="drapecol,femmecol")
+
+##intpalette
+ intpalette(c("white","black"),n=10)
+ grey(seq(1,0,length.out=10))
+ image(matrix(nrow=1,ncol=100,data=1:100),main="intpalette",
+ col=intpalette(c("red","blue"),numcol=100))
+ image(matrix(nrow=1,ncol=100,data=1:100),main="intpalette",
+ col=intpalette(c("red","blue","yellow"),numcol=100))
+ image(matrix(nrow=1,ncol=100,data=1:100),main="intpalette",
+ col=intpalette(c("red","blue","yellow","green"),numcol=100))
+ image(matrix(nrow=1,ncol=100,data=1:100),main="intpalette",
+ col=intpalette(c("red","blue","yellow","green","black"),numcol=100))
+
+
+##shadepalette
+ shadepalette(n=10,"white","black")
+ image(matrix(nrow=1,ncol=100,data=1:100),col=shadepalette(100,"red","blue"),
+ main="shadepalette")
+# rotatexy
+#----------------
+xy <- matrix(ncol=2,data=c(1:5,rep(1,5)))
+plot(xy,xlim=c(-6,6),ylim=c(-6,6),type="b",pch=16,main="rotatexy",col=1)
+for ( i in 1:5) points(rotatexy(xy,mid=c(0,0),angle=60*i),col=i+1,type="b",pch=16)
+points(0,0,cex=2,pch=22,bg="black")
+
+legend("topright",legend=60*(0:5),col=1:6,pch=16,title="angle")
+legend("topleft",legend="midpoint",pt.bg="black",pt.cex=2,pch=22,box.lty=0)
+
+x <- seq(0,2*pi,pi/100)
+y <- sin(x)
+cols <- intpalette(c("blue","green","yellow","red"),n=250)
+cols <- c(cols,rev(cols))
+plot(x,y,type="l",ylim=c(-3,3),main="rotatexy",col=cols[1],lwd=2,xlim=c(-1,7))
+for (i in 2:500) lines(rotatexy(cbind(x,y),angle=0.36*i),col=cols[i],lwd=2)
+
+x <- seq(0,2*pi,pi/100)
+y <- sin(x*2)
+
+cols <- intpalette(c("red","yellow","black"),n=250)
+cols <- c(cols,rev(cols))
+plot(x,y,type="l",ylim=c(-4,5),main="rotatexy, asp=TRUE",col=cols[1],lwd=2,xlim=c(-1,7))
+for (i in 2:500) lines(rotatexy(cbind(x,y),angle=0.36*i,asp=TRUE),col=cols[i],lwd=2)
+
+
+cols <- femmecol(1000)
+plot(x,y,xlim=c(-1,1),ylim=c(-1,1),main="rotatexy",col=cols[1],type="n")
+for (i in 2:1000) {xy<-rotatexy(c(0,1),angle=0.36*i, mid=c(0,0));
+ points(xy[1],xy[2],col=cols[i],pch=".",cex=2)}
+
+# ellipses
+#----------------
+emptyplot(c(-1.5,1.5))
+cols <- rainbow(10)
+SS <- rev(seq(0.1,1,0.1))
+plotellipse(rx=1.5,ry=0.6)
+plotellipse(rx=1.2,ry=0.4)
+for (i in 1:length(SS)) plotellipse(1,SS[i],col=cols[i],type="n")
+title("plotellipse")
+plotellipse(rx=1.5,ry=0.6,angle=0,from=pi,to=2*pi,arrow=TRUE,arr.pos=0.5)
+plotellipse(rx=1.2,ry=0.4,from=pi,to=2*pi)
+
+#
+emptyplot(c(-1.,1.))
+col <- shadepalette(endcol="darkblue",n=100)
+filledellipse (rx1=1,ry1=0.8,col=col,lcol="black")
+plotellipse(rx=1,ry=0.35 ,angle=0,from=pi,to=2*pi,lwd=1,mid=c(0,0.))
+plotellipse(rx=1.1,ry=0.6 ,angle=0,from=1.28*pi,to=1.72*pi,lwd=1,mid=c(0,-0.1))
+plotellipse(rx=0.9 ,ry=0.32,angle=0,from=pi,to=2*pi,lwd=1,mid=c(0,0.35))
+plotellipse(rx=0.65,ry=0.25,angle=0,from=pi,to=2*pi,lwd=1,mid=c(0,0.6))
+plotellipse(rx=0.3 ,ry=0.1,angle=0,from=pi,to=2*pi,lwd=1,mid=c(0,0.75))
+
+plotellipse(rx=0.8,ry=0.0,angle=90,from=pi,to=2*pi,lwd=1)
+plotellipse(rx=0.8,ry=0.35,angle=90,from=pi,to=2*pi,lwd=1)
+plotellipse(rx=0.8,ry=0.6,angle=90,from=pi,to=2*pi,lwd=1)
+plotellipse(rx=0.8,ry=0.8,angle=90,from=pi,to=2*pi,lwd=1)
+
+plotellipse(rx=0.8,ry=0.35,angle=-90,from=pi,to=2*pi,lwd=1)
+plotellipse(rx=0.8,ry=0.6,angle=-90,from=pi,to=2*pi,lwd=1)
+plotellipse(rx=0.8,ry=0.8,angle=-90,from=pi,to=2*pi,lwd=1)
+title("plotellipse, filledellipse")
+
+#
+emptyplot(c(-1,1))
+col <- c(rev(greycol(n=50)),greycol(50))
+filledellipse(rx1=1,rx2=0.5,dr=0.01,col=col)
+title("filledellipse")
+
+#
+emptyplot(c(-1,1),c(-1,1))
+filledellipse(col=col)
+title("filledellipse")
+
+#
+color <-graycol(n=50)
+dr <- 0.05
+emptyplot(xlim=c(-2,2),ylim=c(-2,2),col=color[length(color)])
+
+filledellipse(rx1=1,mid=c(1,1) ,col=shadepalette(endcol="darkblue") ,dr=dr)
+filledellipse(rx1=1,mid=c(-1,-1),col=shadepalette(endcol="darkgreen"),dr=dr)
+filledellipse(rx1=1,mid=c(1,-1) ,col=shadepalette(endcol="darkred") ,dr=dr)
+filledellipse(rx1=1,mid=c(-1,1) ,col=shadepalette(endcol="darkviolet"),dr=dr)
+filledellipse(rx1=1,col=color,dr=dr)
+title("filledellipse")
+
+#
+color <-gray(seq(1,0.3,length.out=50))
+emptyplot(xlim=c(-2,2),ylim=c(-2,2),col=color[length(color)])
+
+filledellipse(rx1=2,ry1=0.4,col=color,angle=45,dr=dr)
+filledellipse(rx1=2,ry1=0.4,col=color,angle=-45,dr=dr)
+filledellipse(rx1=2,ry1=0.4,col=color,angle=0,dr=dr)
+filledellipse(rx1=2,ry1=0.4,col=color,angle=90,dr=dr)
+title("filledellipse")
+
+example(getellipse)
+
+# cylinder
+#----------------
+example(cylindersegment)
+
+example(filledcylinder)
+# shape
+#----------------
+emptyplot(c(-1.,1.))
+xy <- getellipse(rx=1,ry=0.4)
+filledshape(xyouter=xy,xyinner=c(0,1.),col=femmecol(100))
+title("filledshape")
+
+
+example(filledshape)
+
+emptyplot(col="darkgrey",main="filledshape")
+filledshape(matrix(nc=2,runif(100)),col=shadepalette(200,"darkred","darkblue"))
+
+# rectangle
+#----------------
+example(filledrectangle)
+
+# multigonal
+#----------------
+
+color <-shadepalette(grey(0.3),"blue",n=50)
+emptyplot(c(-1,1))
+filledmultigonal(rx=0.25,ry=0.25,col=shadepalette(grey(0.3),"blue",n=50),nr=3,mid=c(0,0),angle=0)
+filledmultigonal(rx=0.25,ry=0.25,col=shadepalette(grey(0.3),"darkgreen",n=50),nr=4,mid=c(0.5,0.5),angle=90)
+filledmultigonal(rx=0.25,ry=0.25,col=shadepalette(grey(0.3),"orange",n=50),nr=5,mid=c(-0.5,-0.5),angle=-90)
+filledmultigonal(rx=0.25,ry=0.25,col="black",nr=6,mid=c(0.5,-0.5),angle=180)
+filledmultigonal(rx=0.25,ry=0.25,col="white",lcol="black",nr=7,mid=c(-0.5,0.5),angle=270)
+title("filledmultigonal")
+
+example(filledmultigonal)
+
+
+# Pipes
+xlim <- ylim <- c(-20,20)
+emptyplot(xlim)
+box()
+
+color <- graycol(n=5)
+color <- c(rev(color),color)
+maxlen <- 15
+maxrad <- 1.0
+
+dr <- 0.01
+angle <- 0
+mid <- c(0,0)
+ry <- 0
+
+numpipes <- 100
+for (i in 1:numpipes)
+{
+
+rnd <- runif(1) # jump length
+length <- maxlen*rnd
+newpos <- rotatexy(mid+c(length+2*maxrad,0),angle,mid)
+
+ # check if within boundaries
+if (! (newpos[1] > xlim[1] & newpos[1] < xlim[2] &
+ newpos[2] > ylim[1] & newpos[2] < ylim[2])) length <- 0
+
+ # rectangle
+mid <- rotatexy(mid+c(length/2,0),angle,mid)
+filledrectangle(wy=maxrad,wx=length,col=color,angle=angle,mid=mid)
+mid <- rotatexy(mid+c(length/2,0),angle,mid)
+
+rnd <- runif(1) # new angle
+ dangle <- 0
+if (rnd <= 0.3333) dangle <- 90
+if (rnd >0.3333 & rnd < 0.6666) dangle <- - 90
+
+piangle <- angle / 180 * pi
+
+if (dangle == 90) # left turn
+ {
+ mid <- rotatexy(mid+c(0,maxrad/2),angle,mid)
+ filledcircle(r1=maxrad,r2=ry,col=color,mid=mid,dr=dr,from= piangle-pi/2,to= piangle)
+ mid <- rotatexy(mid+c(maxrad/2,0),angle,mid)
+ }
+
+if (dangle ==-90) # right turn
+{
+ mid <- rotatexy(mid-c(0,maxrad/2),angle,mid)
+ filledcircle(r1=maxrad,r2=ry,col=color,mid=mid,dr=dr,from= piangle,to= piangle+pi/2)
+ mid <- rotatexy(mid+c(maxrad/2,0),angle,mid)
+}
+angle <- angle + dangle
+if (angle >= 360) angle <- angle - 360
+if (angle < 0) angle <- angle + 360
+
+}
+title("filledrectangle,filledcircle")
+
+
+# Arrowhead
+#----------------
+
+emptyplot(c(0,1))
+
+Arrowhead(x0=runif(10),y0=runif(10),angle=runif(10)*360,
+arr.length=0.4,arr.type="circle",arr.col="green")
+
+Arrowhead(x0=runif(10),y0=runif(10),angle=runif(10)*360,
+arr.length=0.6,arr.type="curved",arr.col="red")
+
+Arrowhead(x0=runif(10),y0=runif(10),angle=runif(10)*360,
+arr.length=0.6,arr.type="triangle",arr.col="blue")
+
+title("Arrowhead")
+
+# Arrows
+#----------------
+example(Arrows)
+xlim <- c(-5 ,5)
+ylim <- c(-10,10)
+plot(0,type="n",xlim=xlim,ylim=ylim)
+x0<-runif(100,xlim[1],xlim[2])
+y0<-runif(100,ylim[1],ylim[2])
+x1<-x0+runif(100,-1,1)
+y1<-y0+runif(100,-1,1)
+size <- 0.6
+ang <- runif(100,-360,360)
+Arrows(x0,y0,x1,y1,arr.length=size,code=2,arr.type="curved",arr.col="white")
+title("Arrows")
+
+plot(0,type="n",xlim=xlim,ylim=ylim)
+Arrows(x0,y0,x1,y1,arr.length=size,code=2,arr.type="triangle",arr.col="yellow")
+title("Arrows")
+
+plot(0,type="n",xlim=xlim,ylim=ylim)
+x0<-runif(100,xlim[1],xlim[2])
+y0<-runif(100,ylim[1],ylim[2])
+x1<-x0+runif(100,-1,1)
+y1<-y0+runif(100,-1,1)
+size <- 0.6
+ang <- runif(100,-360,360)
+Arrows(x0,y0,x1,y1,arr.length=size,code=2,arr.type="circle",arr.col="darkblue")
+title("Arrows")
+
+# Lotka-Volterra competition model
+r1 <- 3 # parameters
+r2 <- 2
+K1 <- 1.5
+K2 <- 2
+alf12 <- 1
+alf21 <- 2
+
+Ax <- c(0,K2/alf21)
+Ay <- K2 - alf21* Ax
+By <- c(0,K1/alf12)
+Bx <- K1 - alf12* By
+xlim <- range(c(Ax, Bx))
+ylim <- range(c(Ay, By))
+
+plot (x=Ax,y=Ay, type="l",lwd=3, # 1st isocline
+ main="Arrows",sub="Model from Soetaert and Herman, 2008. book",
+ xlab="N1",ylab="N2",xlim=xlim,ylim=ylim)
+lines (Bx,By, lty=2,lwd=3) # 2nd isocline
+
+
+gx <- seq(0,1.5,len=40)
+gy <- seq(0,2,len=40)
+N <- as.matrix(expand.grid(x=gx,y=gy))
+
+dN1 <- r1*N[,1]*(1-(N[,1]+alf12* N[,2])/K1)
+dN2 <- r2*N[,2]*(1-(N[,2]+alf21* N[,1])/K2)
+dt <- 0.0001
+Arrows(N[,1],N[,2],N[,1]+dt*dN1,N[,2]+dt*dN2,arr.len=0.15, lcol=grey(0.4),arr.type="triangle")
+points(x=c(0,0,1.5,0.5),y=c(0,2,0,1),pch=22,cex=2,bg=c("white","black","black","grey"))
+
+example(colorlegend)
+
+# Scientific example of use of filledellipse: uses values
+BW <- 10 # mmol/m3, oxygen concentration in surrounding water
+Da <- 0.5 # cm2/d effective diffusion coefficient in organism
+R <- 0.005 # cm radius of organism
+Q <- 250000 # nM/cm3/d oxygen consumption rate per volume per day
+
+# concentration in spherical organism body
+sphere <- function(Da,Q,BW,R,r) BW+Q/(6*Da)*(r^2-R^2)
+
+# distance in organism body
+color <- femmecol(100)
+
+zlim=c(0,BW)
+emptyplot(c(-3.3,3.3),col=color[length(color)],main="Oxygen concentration in spherical organism",
+sub="Model from Soetaert and Herman, 2008. book")
+R <- 0.005
+values <- cbind(rr<-seq(0,R,length=50),sphere(Da,Q,BW,R,rr))
+
+filledellipse(rx1=R*100,mid=c(-2,2),values=values,zlim=zlim,col=color,lcol="black",lwd=1)
+
+R <- 0.0075
+values <- cbind(rr<-seq(0,R,length=50),sphere(Da,Q,BW,R,rr))
+filledellipse(rx1=R*100,mid=c(0,2),values=values,zlim=zlim,col=color,lcol="black",lwd=1)
+
+R <- 0.010
+values <- cbind(rr<-seq(0,R,length=50),sphere(Da,Q,BW,R,rr))
+filledellipse(rx1=R*100,mid=c(2,2),values=values,zlim=zlim,col=color,lcol="black",lwd=1)
+
+R <- 0.015
+values <- cbind(rr<-seq(0,R,length=100),sphere(Da,Q,BW,R,rr))
+filledellipse(rx1=R*100,mid=c(-1,-1),values=values,zlim=zlim,col=color,lcol="black",lwd=1)
+
+segments(-1.5,-3,-0.5,-3,lwd=2,col="black")
+text(-1,-2.8,"10 microm")
+
+colorlegend(zlim=zlim,posy=c(0.05,0.5),posx=c(0.7,0.73),font=2,
+main="micromol/l",main.cex=1.2)
+
diff --git a/inst/doc/shape.R b/inst/doc/shape.R
new file mode 100644
index 0000000..c5b1bbc
--- /dev/null
+++ b/inst/doc/shape.R
@@ -0,0 +1,557 @@
+### R code from vignette source 'shape.Rnw'
+### Encoding: UTF-8
+
+###################################################
+### code chunk number 1: preliminaries
+###################################################
+library("shape")
+options(prompt = "> ")
+options(width=90)
+
+
+###################################################
+### code chunk number 2: s1
+###################################################
+par(mfrow = c(2, 2))
+image(matrix(nrow = 1, ncol = 50, data = 1:50),
+ main = "intpalette",
+ col = intpalette(c("red", "blue", "yellow", "green", "black"),
+ numcol = 50))
+#
+shadepalette(n = 10, "white", "black")
+#
+image(matrix(nrow = 1, ncol = 50, data = 1:50),
+ col = shadepalette(50, "red", "blue"),
+ main = "shadepalette")
+#
+par(mar = c(0, 0, 0, 0))
+persp(volcano, theta = 135, phi = 30, col = drapecol(volcano),
+ main = "drapecol", border = NA)
+
+
+###################################################
+### code chunk number 3: s1
+###################################################
+par(mfrow = c(2, 2))
+image(matrix(nrow = 1, ncol = 50, data = 1:50),
+ main = "intpalette",
+ col = intpalette(c("red", "blue", "yellow", "green", "black"),
+ numcol = 50))
+#
+shadepalette(n = 10, "white", "black")
+#
+image(matrix(nrow = 1, ncol = 50, data = 1:50),
+ col = shadepalette(50, "red", "blue"),
+ main = "shadepalette")
+#
+par(mar = c(0, 0, 0, 0))
+persp(volcano, theta = 135, phi = 30, col = drapecol(volcano),
+ main = "drapecol", border = NA)
+
+
+###################################################
+### code chunk number 4: s2
+###################################################
+par(mfrow = c(2, 2), mar = c(3, 3, 3, 3))
+#
+# rotating points on a line
+#
+xy <- matrix(ncol = 2, data = c(1:5, rep(1, 5)))
+plot(xy, xlim = c(-6, 6), ylim = c(-6, 6), type = "b",
+ pch = 16, main = "rotatexy", col = 1)
+for (i in 1:5)
+ points(rotatexy(xy, mid = c(0, 0), angle = 60*i),
+ col = i+1, type = "b", pch = 16)
+points(0, 0, cex = 2, pch = 22, bg = "black")
+legend("topright", legend = 60*(0:5), col = 1:6, pch = 16,
+ title = "angle")
+legend("topleft", legend = "midpoint", pt.bg = "black",
+ pt.cex = 2, pch = 22, box.lty = 0)
+#
+# rotating lines..
+#
+x <- seq(0, 2*pi, pi/20)
+y <- sin(x)
+cols <- intpalette(c("blue", "green", "yellow", "red"), n = 125)
+cols <- c(cols, rev(cols))
+plot(x, y, type = "l", ylim = c(-3, 3), main = "rotatexy",
+ col = cols[1], lwd = 2, xlim = c(-1, 7))
+for (i in 2:250)
+ lines(rotatexy(cbind(x, y), angle = 0.72*i), col = cols[i], lwd = 2)
+#
+#
+x <- seq(0, 2*pi, pi/20)
+y <- sin(x*2)
+cols <- intpalette(c("red", "yellow", "black"), n = 125)
+cols <- c(cols, rev(cols))
+plot(x, y, type = "l", ylim = c(-4, 5), main = "rotatexy,
+ asp = TRUE", col = cols[1], lwd = 2, xlim = c(-1, 7))
+for (i in 2:250)
+ lines(rotatexy(cbind(x, y), angle = 0.72*i, asp = TRUE),
+ col = cols[i], lwd = 2)
+#
+# rotating points
+#
+cols <- femmecol(500)
+plot(x, y, xlim = c(-1, 1), ylim = c(-1, 1), main = "rotatexy",
+ col = cols[1], type = "n")
+for (i in 2:500) {
+ xy <- rotatexy(c(0, 1), angle = 0.72*i, mid = c(0, 0))
+ points(xy[1], xy[2], col = cols[i], pch = ".", cex = 2)
+}
+
+
+
+###################################################
+### code chunk number 5: s2
+###################################################
+par(mfrow = c(2, 2), mar = c(3, 3, 3, 3))
+#
+# rotating points on a line
+#
+xy <- matrix(ncol = 2, data = c(1:5, rep(1, 5)))
+plot(xy, xlim = c(-6, 6), ylim = c(-6, 6), type = "b",
+ pch = 16, main = "rotatexy", col = 1)
+for (i in 1:5)
+ points(rotatexy(xy, mid = c(0, 0), angle = 60*i),
+ col = i+1, type = "b", pch = 16)
+points(0, 0, cex = 2, pch = 22, bg = "black")
+legend("topright", legend = 60*(0:5), col = 1:6, pch = 16,
+ title = "angle")
+legend("topleft", legend = "midpoint", pt.bg = "black",
+ pt.cex = 2, pch = 22, box.lty = 0)
+#
+# rotating lines..
+#
+x <- seq(0, 2*pi, pi/20)
+y <- sin(x)
+cols <- intpalette(c("blue", "green", "yellow", "red"), n = 125)
+cols <- c(cols, rev(cols))
+plot(x, y, type = "l", ylim = c(-3, 3), main = "rotatexy",
+ col = cols[1], lwd = 2, xlim = c(-1, 7))
+for (i in 2:250)
+ lines(rotatexy(cbind(x, y), angle = 0.72*i), col = cols[i], lwd = 2)
+#
+#
+x <- seq(0, 2*pi, pi/20)
+y <- sin(x*2)
+cols <- intpalette(c("red", "yellow", "black"), n = 125)
+cols <- c(cols, rev(cols))
+plot(x, y, type = "l", ylim = c(-4, 5), main = "rotatexy,
+ asp = TRUE", col = cols[1], lwd = 2, xlim = c(-1, 7))
+for (i in 2:250)
+ lines(rotatexy(cbind(x, y), angle = 0.72*i, asp = TRUE),
+ col = cols[i], lwd = 2)
+#
+# rotating points
+#
+cols <- femmecol(500)
+plot(x, y, xlim = c(-1, 1), ylim = c(-1, 1), main = "rotatexy",
+ col = cols[1], type = "n")
+for (i in 2:500) {
+ xy <- rotatexy(c(0, 1), angle = 0.72*i, mid = c(0, 0))
+ points(xy[1], xy[2], col = cols[i], pch = ".", cex = 2)
+}
+
+
+
+###################################################
+### code chunk number 6: s3
+###################################################
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+emptyplot(c(-1, 1))
+col <- c(rev(greycol(n = 30)), greycol(30))
+filledellipse(rx1 = 1, rx2 = 0.5, dr = 0.1, col = col)
+title("filledellipse")
+#
+emptyplot(c(-1, 1), c(-1, 1))
+filledellipse(col = col, dr = 0.1)
+title("filledellipse")
+#
+color <-gray(seq(1, 0.3, length.out = 30))
+emptyplot(xlim = c(-2, 2), ylim = c(-2, 2), col = color[length(color)])
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = 45, dr = 0.1)
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = -45, dr = 0.1)
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = 0, dr = 0.1)
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = 90, dr = 0.1)
+title("filledellipse")
+#
+emptyplot(main = "getellipse")
+col <-femmecol(90)
+for (i in seq(0, 180, by = 2))
+ lines(getellipse(0.5, 0.25, mid = c(0.5, 0.5), angle = i, dr = 0.1),
+ type = "l", col = col[(i/2)+1], lwd = 2)
+
+
+###################################################
+### code chunk number 7: s3
+###################################################
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+emptyplot(c(-1, 1))
+col <- c(rev(greycol(n = 30)), greycol(30))
+filledellipse(rx1 = 1, rx2 = 0.5, dr = 0.1, col = col)
+title("filledellipse")
+#
+emptyplot(c(-1, 1), c(-1, 1))
+filledellipse(col = col, dr = 0.1)
+title("filledellipse")
+#
+color <-gray(seq(1, 0.3, length.out = 30))
+emptyplot(xlim = c(-2, 2), ylim = c(-2, 2), col = color[length(color)])
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = 45, dr = 0.1)
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = -45, dr = 0.1)
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = 0, dr = 0.1)
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = 90, dr = 0.1)
+title("filledellipse")
+#
+emptyplot(main = "getellipse")
+col <-femmecol(90)
+for (i in seq(0, 180, by = 2))
+ lines(getellipse(0.5, 0.25, mid = c(0.5, 0.5), angle = i, dr = 0.1),
+ type = "l", col = col[(i/2)+1], lwd = 2)
+
+
+###################################################
+### code chunk number 8: s4
+###################################################
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+#
+# simple cylinders
+emptyplot(c(-1.2, 1.2), c(-1, 1), main = "filledcylinder")
+col <- c(rev(greycol(n = 20)), greycol(n = 20))
+col2 <- shadepalette("red", "blue", n = 20)
+col3 <- shadepalette("yellow", "black", n = 20)
+filledcylinder(rx = 0., ry = 0.2, len = 0.25, angle = 0,
+ col = col, mid = c(-1, 0), dr = 0.1)
+filledcylinder(rx = 0.0, ry = 0.2, angle = 90, col = col,
+ mid = c(-0.5, 0), dr = 0.1)
+filledcylinder(rx = 0.1, ry = 0.2, angle = 90, col = c(col2, rev(col2)),
+ mid = c(0.45, 0), topcol = col2[10], dr = 0.1)
+filledcylinder(rx = 0.05, ry = 0.2, angle = 90, col = c(col3, rev(col3)),
+ mid = c(0.9, 0), topcol = col3[10], dr = 0.1)
+filledcylinder(rx = 0.1, ry = 0.2, angle = 90, col = "white",
+ lcol = "black", lcolint = "grey", dr = 0.1)
+#
+# more complex cylinders
+emptyplot(c(-1, 1), c(-1, 1), main = "filledcylinder")
+col <- shadepalette("blue", "black", n = 20)
+col2 <- shadepalette("red", "black", n = 20)
+col3 <- shadepalette("yellow", "black", n = 20)
+filledcylinder(rx = 0.025, ry = 0.2, angle = 90,
+ col = c(col2, rev(col2)), dr = 0.1, mid = c(-0.8, 0),
+ topcol = col2[10], delt = -1., lcol = "black")
+filledcylinder(rx = 0.1, ry = 0.2, angle = 00,
+ col = c(col, rev(col)), dr = 0.1, mid = c(0.0, 0.0),
+ topcol = col, delt = -1.2, lcol = "black")
+filledcylinder(rx = 0.075, ry = 0.2, angle = 90,
+ col = c(col3, rev(col3)), dr = 0.1, mid = c(0.8, 0),
+ topcol = col3[10], delt = 0.0, lcol = "black")
+#
+# rectangles
+color <- shadepalette(grey(0.3), "blue", n = 20)
+emptyplot(c(-1, 1), main = "filledrectangle")
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0, 0), angle = 0)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0.5, 0.5), angle = 90)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(-0.5, -0.5), angle = -90)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0.5, -0.5), angle = 180)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(-0.5, 0.5), angle = 270)
+#
+# multigonal
+color <- shadepalette(grey(0.3), "blue", n = 20)
+emptyplot(c(-1, 1))
+filledmultigonal(rx = 0.25, ry = 0.25,
+ col = shadepalette(grey(0.3), "blue", n = 20),
+ nr = 3, mid = c(0, 0), angle = 0)
+filledmultigonal(rx = 0.25, ry = 0.25,
+ col = shadepalette(grey(0.3), "darkgreen", n = 20),
+ nr = 4, mid = c(0.5, 0.5), angle = 90)
+filledmultigonal(rx = 0.25, ry = 0.25,
+ col = shadepalette(grey(0.3), "orange", n = 20),
+ nr = 5, mid = c(-0.5, -0.5), angle = -90)
+filledmultigonal(rx = 0.25, ry = 0.25, col = "black",
+ nr = 6, mid = c(0.5, -0.5), angle = 180)
+filledmultigonal(rx = 0.25, ry = 0.25, col = "white", lcol = "black",
+ nr = 7, mid = c(-0.5, 0.5), angle = 270)
+title("filledmultigonal")
+
+
+
+###################################################
+### code chunk number 9: s4
+###################################################
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+#
+# simple cylinders
+emptyplot(c(-1.2, 1.2), c(-1, 1), main = "filledcylinder")
+col <- c(rev(greycol(n = 20)), greycol(n = 20))
+col2 <- shadepalette("red", "blue", n = 20)
+col3 <- shadepalette("yellow", "black", n = 20)
+filledcylinder(rx = 0., ry = 0.2, len = 0.25, angle = 0,
+ col = col, mid = c(-1, 0), dr = 0.1)
+filledcylinder(rx = 0.0, ry = 0.2, angle = 90, col = col,
+ mid = c(-0.5, 0), dr = 0.1)
+filledcylinder(rx = 0.1, ry = 0.2, angle = 90, col = c(col2, rev(col2)),
+ mid = c(0.45, 0), topcol = col2[10], dr = 0.1)
+filledcylinder(rx = 0.05, ry = 0.2, angle = 90, col = c(col3, rev(col3)),
+ mid = c(0.9, 0), topcol = col3[10], dr = 0.1)
+filledcylinder(rx = 0.1, ry = 0.2, angle = 90, col = "white",
+ lcol = "black", lcolint = "grey", dr = 0.1)
+#
+# more complex cylinders
+emptyplot(c(-1, 1), c(-1, 1), main = "filledcylinder")
+col <- shadepalette("blue", "black", n = 20)
+col2 <- shadepalette("red", "black", n = 20)
+col3 <- shadepalette("yellow", "black", n = 20)
+filledcylinder(rx = 0.025, ry = 0.2, angle = 90,
+ col = c(col2, rev(col2)), dr = 0.1, mid = c(-0.8, 0),
+ topcol = col2[10], delt = -1., lcol = "black")
+filledcylinder(rx = 0.1, ry = 0.2, angle = 00,
+ col = c(col, rev(col)), dr = 0.1, mid = c(0.0, 0.0),
+ topcol = col, delt = -1.2, lcol = "black")
+filledcylinder(rx = 0.075, ry = 0.2, angle = 90,
+ col = c(col3, rev(col3)), dr = 0.1, mid = c(0.8, 0),
+ topcol = col3[10], delt = 0.0, lcol = "black")
+#
+# rectangles
+color <- shadepalette(grey(0.3), "blue", n = 20)
+emptyplot(c(-1, 1), main = "filledrectangle")
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0, 0), angle = 0)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0.5, 0.5), angle = 90)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(-0.5, -0.5), angle = -90)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0.5, -0.5), angle = 180)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(-0.5, 0.5), angle = 270)
+#
+# multigonal
+color <- shadepalette(grey(0.3), "blue", n = 20)
+emptyplot(c(-1, 1))
+filledmultigonal(rx = 0.25, ry = 0.25,
+ col = shadepalette(grey(0.3), "blue", n = 20),
+ nr = 3, mid = c(0, 0), angle = 0)
+filledmultigonal(rx = 0.25, ry = 0.25,
+ col = shadepalette(grey(0.3), "darkgreen", n = 20),
+ nr = 4, mid = c(0.5, 0.5), angle = 90)
+filledmultigonal(rx = 0.25, ry = 0.25,
+ col = shadepalette(grey(0.3), "orange", n = 20),
+ nr = 5, mid = c(-0.5, -0.5), angle = -90)
+filledmultigonal(rx = 0.25, ry = 0.25, col = "black",
+ nr = 6, mid = c(0.5, -0.5), angle = 180)
+filledmultigonal(rx = 0.25, ry = 0.25, col = "white", lcol = "black",
+ nr = 7, mid = c(-0.5, 0.5), angle = 270)
+title("filledmultigonal")
+
+
+
+###################################################
+### code chunk number 10: s5
+###################################################
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+#an egg
+color <- greycol(30)
+emptyplot(c(-3.2, 3.2), col = color[length(color)],
+ main = "filledshape")
+b <- 4
+a <- 9
+x <- seq(-sqrt(a), sqrt(a), by = 0.1)
+g <- b-b/a*x^2-0.2*b*x+0.2*b/a*x^3
+g[g<0] <- 0
+x1 <- c(x, rev(x))
+g1 <- c(sqrt(g), rev(-sqrt(g)))
+xouter <- cbind(x1, g1)
+xouter <- rbind(xouter, xouter[1, ])
+filledshape(xouter, xyinner = c(-1, 0), col = color)
+#
+# a mill
+color <- shadepalette(grey(0.3), "yellow", n = 20)
+emptyplot(c(-3.3, 3.3), col = color[length(color)],
+ main = "filledshape")
+x <- seq(0, 0.8*pi, pi/20)
+y <- sin(x)
+xouter <- cbind(x, y)
+for (i in seq(0, 360, 60))
+ xouter <- rbind(xouter,
+ rotatexy(cbind(x, y), mid = c(0, 0), angle = i))
+filledshape(xouter, c(0, 0), col = color)
+#
+# abstract art
+emptyplot(col = "darkgrey", main = "filledshape")
+filledshape(matrix(nc = 2, runif(80)), col = "darkblue")
+#
+emptyplot(col = "darkgrey", main = "filledshape")
+filledshape(matrix(nc = 2, runif(80)),
+ col = shadepalette(20, "darkred", "darkblue"))
+
+
+###################################################
+### code chunk number 11: s5
+###################################################
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+#an egg
+color <- greycol(30)
+emptyplot(c(-3.2, 3.2), col = color[length(color)],
+ main = "filledshape")
+b <- 4
+a <- 9
+x <- seq(-sqrt(a), sqrt(a), by = 0.1)
+g <- b-b/a*x^2-0.2*b*x+0.2*b/a*x^3
+g[g<0] <- 0
+x1 <- c(x, rev(x))
+g1 <- c(sqrt(g), rev(-sqrt(g)))
+xouter <- cbind(x1, g1)
+xouter <- rbind(xouter, xouter[1, ])
+filledshape(xouter, xyinner = c(-1, 0), col = color)
+#
+# a mill
+color <- shadepalette(grey(0.3), "yellow", n = 20)
+emptyplot(c(-3.3, 3.3), col = color[length(color)],
+ main = "filledshape")
+x <- seq(0, 0.8*pi, pi/20)
+y <- sin(x)
+xouter <- cbind(x, y)
+for (i in seq(0, 360, 60))
+ xouter <- rbind(xouter,
+ rotatexy(cbind(x, y), mid = c(0, 0), angle = i))
+filledshape(xouter, c(0, 0), col = color)
+#
+# abstract art
+emptyplot(col = "darkgrey", main = "filledshape")
+filledshape(matrix(nc = 2, runif(80)), col = "darkblue")
+#
+emptyplot(col = "darkgrey", main = "filledshape")
+filledshape(matrix(nc = 2, runif(80)),
+ col = shadepalette(20, "darkred", "darkblue"))
+
+
+###################################################
+### code chunk number 12: s6
+###################################################
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+xlim <- c(-5 , 5)
+ylim <- c(-10, 10)
+x0<-runif(100, xlim[1], xlim[2])
+y0<-runif(100, ylim[1], ylim[2])
+x1<-x0+runif(100, -2, 2)
+y1<-y0+runif(100, -2, 2)
+size <- 0.4
+plot(0, type = "n", xlim = xlim, ylim = ylim)
+Arrows(x0, y0, x1, y1, arr.length = size, arr.type = "triangle",
+ arr.col = rainbow(runif(100, 1, 20)))
+title("Arrows")
+#
+# arrow heads
+#
+ang <- runif(100, -360, 360)
+plot(0, type = "n", xlim = xlim, ylim = ylim)
+Arrowhead(x0, y0, ang, arr.length = size, arr.type = "curved",
+ arr.col = rainbow(runif(100, 1, 20)))
+title("Arrowhead")
+#
+# Lotka-Volterra competition model
+#
+r1 <- 3 # parameters
+r2 <- 2
+K1 <- 1.5
+K2 <- 2
+alf12 <- 1
+alf21 <- 2
+
+xlim <- c(0, 1.5)
+ylim <- c(0, 2 )
+par(mar = c(5, 4, 4, 2))
+plot (0, type = "l", lwd = 3, # 1st isocline
+ main = "Lotka-Volterra competition",
+ xlab = "N1", ylab = "N2", xlim = xlim, ylim = ylim)
+
+gx <- seq(0, 1.5, len = 30)
+gy <- seq(0, 2, len = 30)
+N <- as.matrix(expand.grid(x = gx, y = gy))
+
+dN1 <- r1*N[, 1]*(1-(N[, 1]+alf12* N[, 2])/K1)
+dN2 <- r2*N[, 2]*(1-(N[, 2]+alf21* N[, 1])/K2)
+dt <- 0.01
+Arrows(N[, 1], N[, 2], N[, 1]+dt*dN1, N[, 2]+dt*dN2, arr.len = 0.08,
+ lcol = "darkblue", arr.type = "triangle")
+points(x = c(0, 0, 1.5, 0.5), y = c(0, 2, 0, 1), pch = 22, cex = 2,
+ bg = c("white", "black", "black", "grey"))
+
+
+
+###################################################
+### code chunk number 13: s6
+###################################################
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+xlim <- c(-5 , 5)
+ylim <- c(-10, 10)
+x0<-runif(100, xlim[1], xlim[2])
+y0<-runif(100, ylim[1], ylim[2])
+x1<-x0+runif(100, -2, 2)
+y1<-y0+runif(100, -2, 2)
+size <- 0.4
+plot(0, type = "n", xlim = xlim, ylim = ylim)
+Arrows(x0, y0, x1, y1, arr.length = size, arr.type = "triangle",
+ arr.col = rainbow(runif(100, 1, 20)))
+title("Arrows")
+#
+# arrow heads
+#
+ang <- runif(100, -360, 360)
+plot(0, type = "n", xlim = xlim, ylim = ylim)
+Arrowhead(x0, y0, ang, arr.length = size, arr.type = "curved",
+ arr.col = rainbow(runif(100, 1, 20)))
+title("Arrowhead")
+#
+# Lotka-Volterra competition model
+#
+r1 <- 3 # parameters
+r2 <- 2
+K1 <- 1.5
+K2 <- 2
+alf12 <- 1
+alf21 <- 2
+
+xlim <- c(0, 1.5)
+ylim <- c(0, 2 )
+par(mar = c(5, 4, 4, 2))
+plot (0, type = "l", lwd = 3, # 1st isocline
+ main = "Lotka-Volterra competition",
+ xlab = "N1", ylab = "N2", xlim = xlim, ylim = ylim)
+
+gx <- seq(0, 1.5, len = 30)
+gy <- seq(0, 2, len = 30)
+N <- as.matrix(expand.grid(x = gx, y = gy))
+
+dN1 <- r1*N[, 1]*(1-(N[, 1]+alf12* N[, 2])/K1)
+dN2 <- r2*N[, 2]*(1-(N[, 2]+alf21* N[, 1])/K2)
+dt <- 0.01
+Arrows(N[, 1], N[, 2], N[, 1]+dt*dN1, N[, 2]+dt*dN2, arr.len = 0.08,
+ lcol = "darkblue", arr.type = "triangle")
+points(x = c(0, 0, 1.5, 0.5), y = c(0, 2, 0, 1), pch = 22, cex = 2,
+ bg = c("white", "black", "black", "grey"))
+
+
+
+###################################################
+### code chunk number 14: textflag
+###################################################
+emptyplot()
+textflag(mid = c(0.5, 0.5), radx = 0.5, rady = 0.2,
+ lcol = "white", lab = "hello", cex = 5, font = 2:3)
+
+
+###################################################
+### code chunk number 15: textflag
+###################################################
+emptyplot()
+textflag(mid = c(0.5, 0.5), radx = 0.5, rady = 0.2,
+ lcol = "white", lab = "hello", cex = 5, font = 2:3)
+
+
diff --git a/inst/doc/shape.Rnw b/inst/doc/shape.Rnw
new file mode 100644
index 0000000..162e8ad
--- /dev/null
+++ b/inst/doc/shape.Rnw
@@ -0,0 +1,440 @@
+\documentclass[article,nojss]{jss}
+\DeclareGraphicsExtensions{.pdf,.eps}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Add-on packages and fonts
+\usepackage{amsmath}
+\usepackage{xspace}
+\usepackage{verbatim}
+\usepackage[english]{babel}
+%\usepackage{mathptmx}
+%\usepackage{helvet}
+\usepackage[T1]{fontenc}
+\usepackage[latin1]{inputenc}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
+\newcommand{\di}{\textbf{\textsf{diagram}}\xspace}
+
+\title{\proglang{R} Package \pkg{shape}: functions for plotting graphical shapes, colors...}
+
+\Plaintitle{R Package shape: functions for plotting graphical shapes, colors...}
+
+\Keywords{graphics, shapes, colors, R}
+
+\Plainkeywords{graphics, shapes, colors, R}
+
+
+\author{Karline Soetaert\\
+Royal Netherlands Institute of Sea Research\\
+Yerseke, The Netherlands
+}
+
+\Plainauthor{Karline Soetaert}
+
+\Abstract{This document describes how to use the \pkg{shape} package
+for plotting graphical shapes.
+
+Together with R-package \pkg{diagram} \citep{diagram} this package has
+been written to produce the figures of the book \citep{Soetaertbook}
+
+}
+
+%% The address of (at least) one author should be given
+%% in the following format:
+\Address{
+ Karline Soetaert\\
+ Royal Netherlands Institute of Sea Research (NIOZ)\\
+ 4401 NT Yerseke, Netherlands
+ E-mail: \email{karline.soetaert at nioz.nl}\\
+ URL: \url{http://www.nioz.nl}\\
+}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% R/Sweave specific LaTeX commands.
+%% need no \usepackage{Sweave}
+%\VignetteIndexEntry{shape: functions for plotting graphical shapes}
+%\VignetteKeywords{graphics, shapes, colors}
+%\VignettePackage{shape}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Begin of the document
+\begin{document}
+\SweaveOpts{engine=R,eps=FALSE}
+\SweaveOpts{keep.source=TRUE}
+<<preliminaries,echo=FALSE,results=hide>>=
+library("shape")
+options(prompt = "> ")
+options(width=90)
+@
+
+\maketitle
+
+\section{Introduction}
+
+This vignette is the Sweave application of parts of demo
+\code{colorshapes} in package \pkg{shape} \citep{shape}.
+
+
+\section{colors}
+Although one can find similar functions in other packages (including the R
+base package \citep{R2008}),
+\pkg{shape} includes ways to generate color schemes;
+\begin{itemize}
+\item \code{intpalette} creates transitions
+between several colors;
+\item \code{shadepalette} creates a gradient between two colors,
+useful for shading (see below).
+\item \code{drapecol} drapes colors over a \code{persp} plot;
+\end{itemize}
+by default the red-blue-yellow (matlab-type) colors are used.
+The code below demonstrates these functions (Figure \ref{fig:s1})
+<<label=s1, include=FALSE>>=
+par(mfrow = c(2, 2))
+image(matrix(nrow = 1, ncol = 50, data = 1:50),
+ main = "intpalette",
+ col = intpalette(c("red", "blue", "yellow", "green", "black"),
+ numcol = 50))
+#
+shadepalette(n = 10, "white", "black")
+#
+image(matrix(nrow = 1, ncol = 50, data = 1:50),
+ col = shadepalette(50, "red", "blue"),
+ main = "shadepalette")
+#
+par(mar = c(0, 0, 0, 0))
+persp(volcano, theta = 135, phi = 30, col = drapecol(volcano),
+ main = "drapecol", border = NA)
+@
+\begin{figure}
+\begin{center}
+<<label=s1, fig=TRUE,echo=FALSE>>=
+<<s1>>
+@
+\end{center}
+\caption{Use of \code{intpalette}, \code{shadepalette} and \code{drapecol}}
+\label{fig:s1}
+\end{figure}
+
+\section{Rotating}
+Function \code{rotatexy} rotates graphical shapes; it can be used to generate
+strangely-colored shapes (Figure \ref{fig:s2}).
+<<label=s2, include=FALSE>>=
+par(mfrow = c(2, 2), mar = c(3, 3, 3, 3))
+#
+# rotating points on a line
+#
+xy <- matrix(ncol = 2, data = c(1:5, rep(1, 5)))
+plot(xy, xlim = c(-6, 6), ylim = c(-6, 6), type = "b",
+ pch = 16, main = "rotatexy", col = 1)
+for (i in 1:5)
+ points(rotatexy(xy, mid = c(0, 0), angle = 60*i),
+ col = i+1, type = "b", pch = 16)
+points(0, 0, cex = 2, pch = 22, bg = "black")
+legend("topright", legend = 60*(0:5), col = 1:6, pch = 16,
+ title = "angle")
+legend("topleft", legend = "midpoint", pt.bg = "black",
+ pt.cex = 2, pch = 22, box.lty = 0)
+#
+# rotating lines..
+#
+x <- seq(0, 2*pi, pi/20)
+y <- sin(x)
+cols <- intpalette(c("blue", "green", "yellow", "red"), n = 125)
+cols <- c(cols, rev(cols))
+plot(x, y, type = "l", ylim = c(-3, 3), main = "rotatexy",
+ col = cols[1], lwd = 2, xlim = c(-1, 7))
+for (i in 2:250)
+ lines(rotatexy(cbind(x, y), angle = 0.72*i), col = cols[i], lwd = 2)
+#
+#
+x <- seq(0, 2*pi, pi/20)
+y <- sin(x*2)
+cols <- intpalette(c("red", "yellow", "black"), n = 125)
+cols <- c(cols, rev(cols))
+plot(x, y, type = "l", ylim = c(-4, 5), main = "rotatexy,
+ asp = TRUE", col = cols[1], lwd = 2, xlim = c(-1, 7))
+for (i in 2:250)
+ lines(rotatexy(cbind(x, y), angle = 0.72*i, asp = TRUE),
+ col = cols[i], lwd = 2)
+#
+# rotating points
+#
+cols <- femmecol(500)
+plot(x, y, xlim = c(-1, 1), ylim = c(-1, 1), main = "rotatexy",
+ col = cols[1], type = "n")
+for (i in 2:500) {
+ xy <- rotatexy(c(0, 1), angle = 0.72*i, mid = c(0, 0))
+ points(xy[1], xy[2], col = cols[i], pch = ".", cex = 2)
+}
+
+@
+\begin{figure}
+\begin{center}
+<<label=s2,fig=TRUE,echo=FALSE>>=
+<<s2>>
+@
+\end{center}
+\caption{Four examples of \code{rotatexy}}
+\label{fig:s2}
+\end{figure}
+
+\section{ellipses}
+If a suitable shading color is used, function \code{filledellipse} creates spheres,
+ellipses, donuts with 3-D appearance (Figure \ref{fig:s3}).
+<<label=s3, include=FALSE>>=
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+emptyplot(c(-1, 1))
+col <- c(rev(greycol(n = 30)), greycol(30))
+filledellipse(rx1 = 1, rx2 = 0.5, dr = 0.1, col = col)
+title("filledellipse")
+#
+emptyplot(c(-1, 1), c(-1, 1))
+filledellipse(col = col, dr = 0.1)
+title("filledellipse")
+#
+color <-gray(seq(1, 0.3, length.out = 30))
+emptyplot(xlim = c(-2, 2), ylim = c(-2, 2), col = color[length(color)])
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = 45, dr = 0.1)
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = -45, dr = 0.1)
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = 0, dr = 0.1)
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = 90, dr = 0.1)
+title("filledellipse")
+#
+emptyplot(main = "getellipse")
+col <-femmecol(90)
+for (i in seq(0, 180, by = 2))
+ lines(getellipse(0.5, 0.25, mid = c(0.5, 0.5), angle = i, dr = 0.1),
+ type = "l", col = col[(i/2)+1], lwd = 2)
+@
+\begin{figure}
+\begin{center}
+<<label=s3, fig=TRUE, echo=FALSE>>=
+<<s3>>
+@
+\end{center}
+\caption{Use of \code{filledellipse}, and \code{getellipse}}
+\label{fig:s3}
+\end{figure}
+
+\section{Cylinders, rectangles, multigonals}
+The code below draws cylinders, rectangles and multigonals (Figure \ref{fig:s4}).
+<<label=s4, include=FALSE>>=
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+#
+# simple cylinders
+emptyplot(c(-1.2, 1.2), c(-1, 1), main = "filledcylinder")
+col <- c(rev(greycol(n = 20)), greycol(n = 20))
+col2 <- shadepalette("red", "blue", n = 20)
+col3 <- shadepalette("yellow", "black", n = 20)
+filledcylinder(rx = 0., ry = 0.2, len = 0.25, angle = 0,
+ col = col, mid = c(-1, 0), dr = 0.1)
+filledcylinder(rx = 0.0, ry = 0.2, angle = 90, col = col,
+ mid = c(-0.5, 0), dr = 0.1)
+filledcylinder(rx = 0.1, ry = 0.2, angle = 90, col = c(col2, rev(col2)),
+ mid = c(0.45, 0), topcol = col2[10], dr = 0.1)
+filledcylinder(rx = 0.05, ry = 0.2, angle = 90, col = c(col3, rev(col3)),
+ mid = c(0.9, 0), topcol = col3[10], dr = 0.1)
+filledcylinder(rx = 0.1, ry = 0.2, angle = 90, col = "white",
+ lcol = "black", lcolint = "grey", dr = 0.1)
+#
+# more complex cylinders
+emptyplot(c(-1, 1), c(-1, 1), main = "filledcylinder")
+col <- shadepalette("blue", "black", n = 20)
+col2 <- shadepalette("red", "black", n = 20)
+col3 <- shadepalette("yellow", "black", n = 20)
+filledcylinder(rx = 0.025, ry = 0.2, angle = 90,
+ col = c(col2, rev(col2)), dr = 0.1, mid = c(-0.8, 0),
+ topcol = col2[10], delt = -1., lcol = "black")
+filledcylinder(rx = 0.1, ry = 0.2, angle = 00,
+ col = c(col, rev(col)), dr = 0.1, mid = c(0.0, 0.0),
+ topcol = col, delt = -1.2, lcol = "black")
+filledcylinder(rx = 0.075, ry = 0.2, angle = 90,
+ col = c(col3, rev(col3)), dr = 0.1, mid = c(0.8, 0),
+ topcol = col3[10], delt = 0.0, lcol = "black")
+#
+# rectangles
+color <- shadepalette(grey(0.3), "blue", n = 20)
+emptyplot(c(-1, 1), main = "filledrectangle")
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0, 0), angle = 0)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0.5, 0.5), angle = 90)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(-0.5, -0.5), angle = -90)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0.5, -0.5), angle = 180)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(-0.5, 0.5), angle = 270)
+#
+# multigonal
+color <- shadepalette(grey(0.3), "blue", n = 20)
+emptyplot(c(-1, 1))
+filledmultigonal(rx = 0.25, ry = 0.25,
+ col = shadepalette(grey(0.3), "blue", n = 20),
+ nr = 3, mid = c(0, 0), angle = 0)
+filledmultigonal(rx = 0.25, ry = 0.25,
+ col = shadepalette(grey(0.3), "darkgreen", n = 20),
+ nr = 4, mid = c(0.5, 0.5), angle = 90)
+filledmultigonal(rx = 0.25, ry = 0.25,
+ col = shadepalette(grey(0.3), "orange", n = 20),
+ nr = 5, mid = c(-0.5, -0.5), angle = -90)
+filledmultigonal(rx = 0.25, ry = 0.25, col = "black",
+ nr = 6, mid = c(0.5, -0.5), angle = 180)
+filledmultigonal(rx = 0.25, ry = 0.25, col = "white", lcol = "black",
+ nr = 7, mid = c(-0.5, 0.5), angle = 270)
+title("filledmultigonal")
+
+@
+\begin{figure}
+\begin{center}
+<<label = s4, fig = TRUE,echo = FALSE>>=
+<<s4>>
+@
+\end{center}
+\caption{Use of \code{filledcylinder}, \code{filledrectangle} and
+ \code{filledmultigonal}}
+\label{fig:s4}
+\end{figure}
+\section{Other shapes}
+Function \code{filledshape} is the most flexible drawing function from
+ \pkg{shape}: just specify an inner and outer shape and
+ fill with a color scheme (Figure \ref{fig:s5}).
+<<label = s5, include = FALSE>>=
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+#an egg
+color <- greycol(30)
+emptyplot(c(-3.2, 3.2), col = color[length(color)],
+ main = "filledshape")
+b <- 4
+a <- 9
+x <- seq(-sqrt(a), sqrt(a), by = 0.1)
+g <- b-b/a*x^2-0.2*b*x+0.2*b/a*x^3
+g[g<0] <- 0
+x1 <- c(x, rev(x))
+g1 <- c(sqrt(g), rev(-sqrt(g)))
+xouter <- cbind(x1, g1)
+xouter <- rbind(xouter, xouter[1, ])
+filledshape(xouter, xyinner = c(-1, 0), col = color)
+#
+# a mill
+color <- shadepalette(grey(0.3), "yellow", n = 20)
+emptyplot(c(-3.3, 3.3), col = color[length(color)],
+ main = "filledshape")
+x <- seq(0, 0.8*pi, pi/20)
+y <- sin(x)
+xouter <- cbind(x, y)
+for (i in seq(0, 360, 60))
+ xouter <- rbind(xouter,
+ rotatexy(cbind(x, y), mid = c(0, 0), angle = i))
+filledshape(xouter, c(0, 0), col = color)
+#
+# abstract art
+emptyplot(col = "darkgrey", main = "filledshape")
+filledshape(matrix(nc = 2, runif(80)), col = "darkblue")
+#
+emptyplot(col = "darkgrey", main = "filledshape")
+filledshape(matrix(nc = 2, runif(80)),
+ col = shadepalette(20, "darkred", "darkblue"))
+@
+\begin{figure}
+\begin{center}
+<<label = s5, fig=TRUE, echo=FALSE>>=
+<<s5>>
+@
+\end{center}
+\caption{Use of \code{filledshape}}
+\label{fig:s5}
+\end{figure}
+
+\section{arrows, arrowheads}
+As the arrow heads in the R base package are too simple for some applications,
+there are some improved arrow heads in \pkg{shape} (Figure \ref{fig:s6}).
+<<label = s6, include=FALSE>>=
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+xlim <- c(-5 , 5)
+ylim <- c(-10, 10)
+x0<-runif(100, xlim[1], xlim[2])
+y0<-runif(100, ylim[1], ylim[2])
+x1<-x0+runif(100, -2, 2)
+y1<-y0+runif(100, -2, 2)
+size <- 0.4
+plot(0, type = "n", xlim = xlim, ylim = ylim)
+Arrows(x0, y0, x1, y1, arr.length = size, arr.type = "triangle",
+ arr.col = rainbow(runif(100, 1, 20)))
+title("Arrows")
+#
+# arrow heads
+#
+ang <- runif(100, -360, 360)
+plot(0, type = "n", xlim = xlim, ylim = ylim)
+Arrowhead(x0, y0, ang, arr.length = size, arr.type = "curved",
+ arr.col = rainbow(runif(100, 1, 20)))
+title("Arrowhead")
+#
+# Lotka-Volterra competition model
+#
+r1 <- 3 # parameters
+r2 <- 2
+K1 <- 1.5
+K2 <- 2
+alf12 <- 1
+alf21 <- 2
+
+xlim <- c(0, 1.5)
+ylim <- c(0, 2 )
+par(mar = c(5, 4, 4, 2))
+plot (0, type = "l", lwd = 3, # 1st isocline
+ main = "Lotka-Volterra competition",
+ xlab = "N1", ylab = "N2", xlim = xlim, ylim = ylim)
+
+gx <- seq(0, 1.5, len = 30)
+gy <- seq(0, 2, len = 30)
+N <- as.matrix(expand.grid(x = gx, y = gy))
+
+dN1 <- r1*N[, 1]*(1-(N[, 1]+alf12* N[, 2])/K1)
+dN2 <- r2*N[, 2]*(1-(N[, 2]+alf21* N[, 1])/K2)
+dt <- 0.01
+Arrows(N[, 1], N[, 2], N[, 1]+dt*dN1, N[, 2]+dt*dN2, arr.len = 0.08,
+ lcol = "darkblue", arr.type = "triangle")
+points(x = c(0, 0, 1.5, 0.5), y = c(0, 2, 0, 1), pch = 22, cex = 2,
+ bg = c("white", "black", "black", "grey"))
+
+@
+\begin{figure}
+\begin{center}
+<<label = s6, fig=TRUE,echo=FALSE>>=
+<<s6>>
+@
+\end{center}
+\caption{Use of \code{Arrows} and \code{Arrowhead} }
+\label{fig:s6}
+\end{figure}
+
+\section{Miscellaneous}
+Since version 1.3.4, function \code{textflag} has been added.
+<<label = textflag, include=FALSE>>=
+emptyplot()
+textflag(mid = c(0.5, 0.5), radx = 0.5, rady = 0.2,
+ lcol = "white", lab = "hello", cex = 5, font = 2:3)
+@
+\setkeys{Gin}{width=0.8\textwidth}
+\begin{figure}[ht]
+\begin{center}
+<<label = textflag, fig=TRUE,echo=FALSE, width = 12, height = 6>>=
+<<textflag>>
+@
+\end{center}
+\caption{Use of function \code{textflag} }
+\label{fig:textflag}
+\end{figure}
+\section{And finally}
+
+This vignette was created using Sweave \citep{Leisch02}.
+
+The package is on CRAN, the R-archive website (\citep{R2008})
+
+More examples can be found in the demo's of package \pkg{ecolMod} \citep{ecolMod}
+
+\bibliography{vignettes}
+
+\end{document}
+
diff --git a/inst/doc/shape.pdf b/inst/doc/shape.pdf
new file mode 100644
index 0000000..a2b506e
Binary files /dev/null and b/inst/doc/shape.pdf differ
diff --git a/man/A4.Rd b/man/A4.Rd
new file mode 100644
index 0000000..eea2ff1
--- /dev/null
+++ b/man/A4.Rd
@@ -0,0 +1,20 @@
+\name{A4}
+\alias{A4}
+\title{opens A4-sized window}
+\description{
+ opens a graphics window, 8.5 inches wide, 11 inches high
+}
+
+\usage{
+A4 (...)
+}
+
+\arguments{
+ \item{... }{arguments passed to R-function X11.
+ }
+}
+
+\author{Karline Soetaert <karline.soetaert at nioz.nl>}
+
+\keyword{device}
+
diff --git a/man/Arrowhead.Rd b/man/Arrowhead.Rd
new file mode 100644
index 0000000..0a11ef1
--- /dev/null
+++ b/man/Arrowhead.Rd
@@ -0,0 +1,92 @@
+\name{Arrowhead}
+\alias{Arrowhead}
+\title{adds arrowheads to a plot}
+\description{
+ adds one or more arrowheads to a plot; shape is either curved,
+ a triangle, a circle or ellipse.
+}
+
+\usage{
+Arrowhead(x0, y0, angle = 0, arr.length = 0.4,
+ arr.width = arr.length/2, arr.adj = 0.5,
+ arr.type = "curved", lcol = "black", lty = 1,
+ arr.col = lcol, arr.lwd = 2, npoint = 5)
+}
+
+\arguments{
+ \item{x0 }{x-coordinates of points at which to draw arrowhead;
+ either one value or a vector.
+ }
+ \item{y0 }{y-coordinates of points at which to draw arrowhead;
+ either one value or a vector.
+ }
+ \item{angle }{angle of arrowhead (anti-clockwise, relative to x-axis),
+ in degrees [0,360]; either one value or a vector.
+ }
+ \item{arr.length }{approximate length of arrowhead, in cm;
+ either one value or a vector.
+ }
+ \item{arr.width }{approximate width of arrowhead, in cm;
+ either one value or a vector.
+ }
+ \item{arr.adj }{0,0.5,1 specifying the adjustment of the arrowhead.
+ }
+ \item{arr.type }{type of arrowhead to draw, one of
+ "curved","triangle","circle","ellipse".
+ }
+ \item{lcol }{line color specifications; either one value or a vector.
+ }
+ \item{lty }{line type specifications; either one value or a vector.
+ }
+ \item{arr.col }{color of arrowhead; either one value or a vector.
+ }
+ \item{arr.lwd }{line width of arrowhead.
+ }
+ \item{npoint }{only if \code{arr.type} = "curved": number of points to
+ draw the curve; increase for smoother arrowheads}
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+emptyplot(main = "Arrowhead")
+Arrowhead(x0 = runif(10), y0 = runif(10), angle = runif(10)*360,
+ arr.length = 0.3, arr.type = "circle", arr.col = "green")
+Arrowhead(x0 = runif(10), y0 = runif(10), angle = runif(10)*360,
+ arr.length = 0.4, arr.type = "curved", arr.col = "red")
+Arrowhead(x0 = runif(10), y0 = runif(10), angle = runif(10)*360,
+ arr.length = runif(10), arr.type = "triangle",
+ arr.col = rainbow(10))
+}
+
+\details{
+ \code{x0}, \code{y0}, \code{angle}, \code{arr.length}, \code{arr.width},
+ \code{lcol}, \code{lty} and \code{arr.col} can be a vector,
+ of the same length.
+
+ \itemize{
+ \item if \code{arr.adj} = 0.5, then the centre of the arrowhead is
+ at the point at which it is drawn.
+ \item \code{arr.adj} = 1 causes the tip of the arrowhead to
+ touch the point.
+ \item \code{arr.adj} = 0 causes the base of the arrowhead to
+ touch the point.
+ }
+ The type of the arrowhead is set with \code{arr.type} which can take
+ the values:
+ \itemize{
+ \item "triangle": uses filled triangle
+ \item "curved" : draws arrowhead with curved edges
+ \item "circle" : draws circular head (where arr.width=arr.length)
+ \item "ellipse" : draws ellipsoid head
+ }
+}
+
+\seealso{
+ \code{\link{Arrows}}
+}
+
+\keyword{aplot}
+
diff --git a/man/Arrows.Rd b/man/Arrows.Rd
new file mode 100644
index 0000000..8a04ef1
--- /dev/null
+++ b/man/Arrows.Rd
@@ -0,0 +1,161 @@
+\name{Arrows}
+\alias{Arrows}
+\title{
+ adds arrows with improved arrowhead to a plot
+}
+
+\description{
+ adds one or more arrows to a plot; arrowhead shape is either curved,
+ a triangle, a circle or simple
+}
+
+\usage{
+Arrows(x0, y0, x1, y1, code = 2, arr.length = 0.4,
+ arr.width = arr.length/2, arr.adj = 0.5, arr.type = "curved",
+ segment = TRUE, col = "black", lcol = col, lty = 1, arr.col = lcol,
+ lwd = 1, arr.lwd = lwd, ...)
+}
+
+\arguments{
+ \item{x0 }{x-coordinates of points *from* which to draw arrows;
+ either one value or a vector.
+ }
+ \item{y0 }{y-coordinates of points *from* which to draw arrows;
+ either one value or a vector.
+ }
+ \item{x1 }{x-coordinates of points *to* which to draw arrows;
+ either one value or a vector.
+ }
+ \item{y1 }{y-coordinates of points *to* which to draw arrows;
+ either one value or a vector.
+ }
+ \item{code }{integer code determining kind of arrows to draw.
+ }
+ \item{arr.length }{approximate length of arrowhead, in cm;
+ either one value or a vector.
+ }
+ \item{arr.width }{approximate width of arrowhead, in cm;
+ either one value or a vector.
+ }
+ \item{arr.adj }{0,0.5,1 specifying the adjustment of the arrowhead.
+ }
+ \item{arr.type }{type of arrowhead to draw, one of "simple", "curved",
+ "triangle", "circle", "ellipse" or "T".
+ }
+ \item{segment }{logical specifying whether or not to draw line segments.
+ }
+ \item{col }{general line color specification; one value or a vector.
+ }
+ \item{lcol }{line color specifications; either one value or a vector.
+ ignored when arr.type = \code{"simple"} or \code{"T"} - use "col"
+ }
+ \item{lty }{line type specifications; either one value or a vector.
+ }
+ \item{arr.col }{color of arrowhead; either one value or a vector.
+ }
+ \item{lwd }{general line width specification.
+ The default value changed to 1 from version 1.4 (was 2)
+ }
+ \item{arr.lwd }{line width of arrowhead.
+ }
+ \item{... }{arguments passed to lines or segments function.
+ }
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+xlim <- c(-5 , 5)
+ylim <- c(-10, 10)
+plot(0, type = "n", xlim = xlim, ylim = ylim,
+ main = "Arrows, type = 'curved'")
+x0 <- runif(100, xlim[1], xlim[2])
+y0 <- runif(100, ylim[1], ylim[2])
+x1 <- x0+runif(100, -1, 1)
+y1 <- y0+runif(100, -1, 1)
+Arrows(x0, y0, x1, y1, arr.length = runif(100), code = 2,
+ arr.type = "curved", arr.col = 1:100, lcol = 1:100)
+
+plot(0, type = "n", xlim = xlim, ylim = ylim,
+ main = "Arrows, type = 'circle'")
+x0 <- runif(100, xlim[1], xlim[2])
+y0 <- runif(100, ylim[1], ylim[2])
+x1 <- x0 + runif(100, -1, 1)
+y1 <- y0 + runif(100, -1, 1)
+Arrows(x0, y0, x1, y1, arr.length = 0.2, code = 3,
+ arr.type = "circle", arr.col = "grey")
+
+plot(0, type = "n", xlim = xlim, ylim = ylim,
+ main = "Arrows, type = 'ellipse'")
+Arrows(x0, y0, x1, y1, arr.length = 0.2, arr.width = 0.5,
+ code = 3, arr.type = "ellipse", arr.col = "grey")
+
+curve(expr = sin(x), 0, 2*pi+0.25, main = "Arrows")
+x <- seq(0, 2*pi, length.out = 10)
+xd <- x + 0.025
+Arrows(x, sin(x), xd, sin(xd), type = "triangle",
+ arr.length = 0.5, segment = FALSE)
+
+xx <- seq(0, 10*pi, length.out = 1000)
+plot(sin(xx)*xx, cos(xx)*xx, type = "l", axes = FALSE,
+ xlab = "", ylab = "", main = "Arrows, type = 'curved'")
+x <- seq(0, 10*pi, length.out = 20)
+x1 <- sin(x)*x
+y1 <- cos(x)*x
+xd <- x+0.01
+x2 <- sin(xd)*xd
+y2 <- cos(xd)*xd
+Arrows(x1, y1, x2, y2, arr.type = "curved", arr.length = 0.4,
+ segment = FALSE, code = 1, arr.adj = 0.5 )
+
+plot(sin(xx)*xx, cos(xx)*xx, type = "l", axes = FALSE,
+ xlab = "", ylab = "", main = "Arrows, type = 'T'")
+Arrows(x1, y1, x2, y2, arr.type = "T", arr.length = 0.4,
+ code = 1, arr.lwd = 2)
+
+}
+
+\details{
+ \code{x0}, \code{y0}, \code{x1}, \code{y1}, \code{arr.length},
+ \code{arr.width}, \code{arr.adj}, \code{lcol}, \code{lty} and
+ \code{arr.col} can be a vector, of the same length.
+
+ For each 'i', an arrow is drawn between the point '(x0[i], y0[i])'
+ and the point '(x1[i],y1[i])'.
+
+ \itemize{
+ \item If \code{code}=1 an arrowhead is drawn at '(x0[i],y0[i])'
+ \item if \code{code}=2 an arrowhead is drawn at '(x1[i],y1[i])'.
+ \item If \code{code}=3 an arrowhead is drawn at both ends of the arrow
+ \item unless \code{arr.length} = 0, when no head is drawn.
+ }
+ \itemize{
+ \item If \code{arr.adj} = 0.5 then the centre of the arrowhead is at
+ the point at which it is drawn.
+ \item \code{arr.adj} = 1 causes the tip of the arrowhead to touch
+ the point.
+ \item \code{arr.adj} = 2 causes the base of the arrowhead to touch
+ the point.
+ }
+ The type of the arrowhead is set with \code{arr.type} which can take
+ the values:
+ \itemize{
+ \item "simple" : uses comparable \R function \link{arrows}
+ \item "triangle": uses filled triangle
+ \item "curved" : draws arrowhead with curved edges
+ \item "circle" : draws circular head
+ \item "ellipse" : draws ellepsoid head
+ \item "T" : draws T-shaped (blunt) head
+ }
+}
+
+\seealso{
+ \code{\link{arrows}} the comparable R function
+
+ \code{\link{Arrowhead}}
+}
+
+\keyword{aplot}
+
diff --git a/man/colorlegend.Rd b/man/colorlegend.Rd
new file mode 100644
index 0000000..c0e7da2
--- /dev/null
+++ b/man/colorlegend.Rd
@@ -0,0 +1,83 @@
+\name{colorlegend}
+\alias{colorlegend}
+\title{
+ adds a color legend to a plot.
+}
+\description{
+ Adds a color legend to a plot.
+}
+\usage{
+colorlegend(col = femmecol(100), zlim, zlevels = 5, dz = NULL,
+ zval = NULL, log = FALSE, posx = c(0.9, 0.93),
+ posy = c(0.05, 0.9), main = NULL, main.cex = 1.0,
+ main.col = "black", lab.col = "black",
+ digit = 0, left = FALSE, ...)
+}
+
+\arguments{
+ \item{col }{color palette to be used; also allowed are two extremes
+ or one value.
+ }
+ \item{zlim }{two-valued vector, the minimum and maximum z values.
+ }
+ \item{zlevels }{number of z-levels, one value, ignored if \code{dz} or
+ \code{zval} not equal to \code{NULL}.
+ }
+ \item{dz }{increment in legend values, one value; ignored if \code{zval}
+ not equal to \code{NULL}.
+ }
+ \item{zval }{a vector of z-values to label legend.
+ }
+ \item{log }{logical indicating whether to log transform or not.
+ }
+ \item{posx }{relative position of left and right edge of color bar on
+ first axis, [0,1].
+ }
+ \item{posy }{relative position on lower and upper edge of colar bar on
+ second axis, [0,1].
+ }
+ \item{main }{main title, written above the color bar.
+ }
+ \item{main.cex }{relative size of main title.
+ }
+ \item{main.col }{color of main title.
+ }
+ \item{lab.col }{color of labels.
+ }
+ \item{digit }{number of significant digits in labels.
+ }
+ \item{left }{logical indicating whether to put the labels on the right
+ (\code{TRUE}) or on the left (\code{FALSE}).
+ }
+ \item{... }{arguments passed to R-function \link{text} when writing labels.
+ }
+}
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+emptyplot(main = "colorlegend")
+colorlegend(zlim = c(0, 10))
+colorlegend(posx = c(0.8, 0.83), col = greycol(100),
+ zlim = c(0, 1), digit = 1)
+colorlegend(posx = c(0.7, 0.73), left = TRUE, col = rainbow(100),
+ zlim = c(0, 10), digit = 1, dz = 2.5)
+colorlegend(posx = c(0.5, 0.53),
+ col = intpalette(c("red", "yellow", "black"), 100),
+ zlim = c(0, 20), zval = c(1, 3, 7, 15))
+colorlegend(posy = c(0.0, 0.15), posx = c(0.2, 0.3),
+ col = rainbow(100), zlim = c(0, 1),
+ zlevels = NULL, main = "rainbow")
+colorlegend(posy = c(0.25, 0.4), posx = c(0.2, 0.3),
+ zlim = c(0, 1), zlevels = NULL, main = "femmecol")
+colorlegend(posy = c(0.5, 0.65), posx = c(0.2, 0.3),
+ col = terrain.colors(100), zlim = c(0, 1),
+ zlevels = NULL, main = "terrain.colors")
+colorlegend(posy = c(0.75, 0.9), posx = c(0.2, 0.3),
+ col = heat.colors(100), zlim = c(0, 1),
+ zlevels = NULL, main = "heat.colors")
+}
+
+\keyword{aplot}
+
diff --git a/man/cylindersegment.Rd b/man/cylindersegment.Rd
new file mode 100644
index 0000000..f7faf9b
--- /dev/null
+++ b/man/cylindersegment.Rd
@@ -0,0 +1,79 @@
+\name{cylindersegment}
+\alias{cylindersegment}
+\title{
+ adds part of a cylinder to a plot
+}
+\description{
+ adds a segment of a cylinder to a plot
+}
+
+\usage{
+cylindersegment(rx = 1, ry = rx, from = pi, to = 3*pi/2, len = 1,
+ mid = c(0,0), angle = 0, dr = 0.01, col = "black",
+ delt = 1.0, ...)
+}
+
+\arguments{
+ \item{rx }{horizontal radius of full cylinder.
+ }
+ \item{ry }{vertical radius of full cylinder.
+ }
+ \item{from }{start radius of segment, radians.
+ }
+ \item{to }{end radius of segment, radians.
+ }
+ \item{len }{cylinder length.
+ }
+ \item{mid }{midpoint of cylinder.
+ }
+ \item{angle }{rotation angle, degrees.
+ }
+ \item{dr }{size of segments, in radians, to draw top/bottom ellipse
+ (decrease for smoother).
+ }
+ \item{col }{color of slice.
+ }
+ \item{delt }{increase factor, from left to right.
+ }
+ \item{... }{arguments passed to \link{polygon} function.
+ }
+}
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+emptyplot(main = "cylindersegment")
+cylindersegment(mid = c(0.1, 0.5), rx = 0.1, ry = 0.1,
+ from = pi, to = 3*pi/2, col = "blue",
+ len = 0.5, delt = 1.1, lwd = 2, angle = 90)
+cylindersegment(mid = c(0.8, 0.5), rx = 0.1, ry = 0.1,
+ from = 0, to = pi/2, col = "red", len = 0.5,
+ delt = 1.0, lwd = 2, angle = 45)
+cylindersegment(mid = c(0.5, 0.5), rx = 0.1, ry = 0.1,
+ from = pi/2, to = pi, col = "lightblue",
+ len = 0.2, delt = 1.5, lwd = 2)
+for (i in seq(0.1, 0.9, 0.1))
+ cylindersegment(mid = c(i, 0.9), rx = 0.035, ry = 0.05,
+ from = pi/2, to = 3*pi/2, col = "darkblue",
+ len = 0.1, angle = 90)
+}
+
+\details{
+ When \code{angle} = 0 (the default), the cylindersegment is parallel
+ to the x-axis.
+
+ \code{rx} and \code{ry} are the horizontal and vertical radiusses of
+ the bordering ellipses.
+ Here "horizontal" and "vertical" denote the position BEFORE rotation
+
+ if \code{delt} > 1, the width of the cylinder will increase from
+ left to right.
+}
+
+\seealso{
+ \code{\link{filledcylinder}}
+}
+
+\keyword{aplot}
+
diff --git a/man/drapecol.Rd b/man/drapecol.Rd
new file mode 100644
index 0000000..2794a77
--- /dev/null
+++ b/man/drapecol.Rd
@@ -0,0 +1,49 @@
+\name{drapecol}
+\alias{drapecol}
+\title{
+ draping colors over a persp plot
+}
+
+\description{
+ generates color(s) that will appear on the surface facets of a "persp" plot.
+}
+\usage{
+drapecol(A, col = femmecol(100), NAcol = "white", lim = NULL)
+}
+
+\arguments{
+ \item{A }{matrix with input grid.
+ }
+ \item{col }{color palette.
+ }
+ \item{NAcol }{color of \code{NA} elements.
+ }
+ \item{lim }{The limits of the data; if \code{NULL}, the data range will be chosen.
+ }
+}
+\value{
+ a vector of character strings giving the colors in hexadecimal format,
+ one for each surface facet.
+}
+
+\note{
+ This function is inspired by a similar function in package \code{fields},
+ unfortunately made unavailable in most recent version of fields
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+\examples{
+persp(volcano, theta = 135, phi = 30, col = drapecol(volcano),
+ main = "drapecol")
+persp(volcano, theta = 135, phi = 30, col = drapecol(volcano),
+ border = NA, main = "drapecol")
+}
+
+\seealso{
+ \code{\link{persp}}
+}
+
+\keyword{aplot}
+
diff --git a/man/emptyplot.Rd b/man/emptyplot.Rd
new file mode 100644
index 0000000..72e5296
--- /dev/null
+++ b/man/emptyplot.Rd
@@ -0,0 +1,37 @@
+\name{emptyplot}
+\alias{emptyplot}
+\title{open a plot without axes, labels,...}
+\description{
+ Creates a plotting region, bounded by xlim and ylim;
+ without axes, labels, titles, useful for plotting shapes.
+}
+\usage{
+emptyplot(xlim = c(0, 1), ylim = xlim, asp = 1, frame.plot = FALSE,
+ col = NULL, ...)
+}
+
+\arguments{
+ \item{xlim }{the x limits (min,max) of the plot.
+ }
+ \item{ylim }{the y limits (min,max) of the plot.
+ }
+ \item{asp }{the y/x aspect ratio.
+ }
+ \item{frame.plot }{to toggle off drawing of a bounding box.
+ }
+ \item{col }{the background color.
+ }
+ \item{... }{arguments passed to R-function \link{plot}.
+ }
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\seealso{
+ \code{\link{plot}}, \code{\link{plot.default}}
+}
+
+\keyword{hplot}
+
diff --git a/man/femmecol.Rd b/man/femmecol.Rd
new file mode 100644
index 0000000..0b50c69
--- /dev/null
+++ b/man/femmecol.Rd
@@ -0,0 +1,41 @@
+\name{femmecol}
+\alias{femmecol}
+\title{red-green-blue color palette}
+\description{
+ Creates a vector of (n) contiguous colors
+ (darkblue-blue-cyan-yellow-red-darkred).
+}
+
+\usage{
+femmecol(n = 100)
+}
+
+\arguments{
+ \item{n }{number of colors.
+ }
+}
+
+\value{
+ a vector of character strings giving the colors in hexadecimal format
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+filled.contour(volcano, color = femmecol, asp = 1, main = "femmecol")
+femmecol(10)
+image(matrix(nrow = 1, ncol = 100, data = 1:100),
+ col = femmecol(100), main = "femmecol")
+}
+
+\seealso{
+ \code{\link{rainbow}}, \code{\link{heat.colors}},
+ \code{\link{topo.colors}}, the comparable R-functions.
+
+ \code{\link{intpalette}}, \code{\link{shadepalette}}
+}
+
+\keyword{color}
+
diff --git a/man/filledcircle.Rd b/man/filledcircle.Rd
new file mode 100644
index 0000000..8e4c397
--- /dev/null
+++ b/man/filledcircle.Rd
@@ -0,0 +1,85 @@
+\name{filledcircle}
+\alias{filledcircle}
+\title{
+ adds colored circle to a plot
+}
+
+\description{
+ plots (part of) outer and inner circle and colors inbetween;
+ color can be a palette.
+}
+
+\usage{
+filledcircle(r1 = 1, r2 = 0, mid = c(0,0), dr = 0.01, from = -pi, to = pi,
+ col = femmecol(100), values = NULL, zlim = NULL, lwd = 2, lcol = NA, ...)
+}
+
+\arguments{
+ \item{r1 }{radius of outer circle.
+ }
+ \item{r2 }{radius of inner circle.
+ }
+ \item{mid }{midpoint of circle.
+ }
+ \item{dr }{size of segments, in radians, to draw circle
+ (decrease for smoother).
+ }
+ \item{from }{starting angle for circle segment, radians.
+ }
+ \item{to }{final angle for circle segment, radians. The segment is drawn
+ counterclockwise. The default is to draw a full circle.
+ }
+ \item{col }{color palette to be used; also allowed are two extremes or one
+ value.
+ }
+ \item{values }{if not \code{NULL}, a matrix providing (radius,z-values)
+ couples, used for coloring. .
+ }
+ \item{zlim }{Only if \code{values} is not \code{NULL}: the minimum and
+ maximum z values for which colors should be plotted, defaulting to the
+ range of the finite values of the second column of \code{values}.
+ }
+ \item{lwd }{width of external line.
+ }
+ \item{lcol }{line color.
+ }
+ \item{... }{arguments passed to R-function \link{polygon}.
+ }
+}
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+color <-graycol(n = 50)
+dr <- 0.05
+emptyplot(xlim = c(-2, 2), col = color[length(color)],
+ main = "filledcircle")
+filledcircle(r1 = 1, mid = c(1, 1), dr = dr,
+ col = shadepalette(endcol = "darkblue"))
+filledcircle(r1 = 1, mid = c(-1, -1), dr = dr,
+ col = shadepalette(endcol = "darkred"))
+filledcircle(r1 = 1, r2 = 0.5, mid = c(0, 0), dr = dr,
+ col = c(rev(color), color))
+filledcircle(r1 = 1, mid = c(1, -1), dr = dr,
+ col = intpalette(c("red", "blue", "orange"), 100))
+filledcircle(mid = c(-1, 1))
+
+emptyplot(main = "filledcircle")
+
+for (i in seq(0, 0.45, 0.05))
+ filledcircle(r1 = i+0.05, r2 = i,
+ mid = c(0.5, 0.5), col = i*20)
+}
+
+\details{
+ see \code{\link{filledellipse}} for details
+}
+
+\seealso{
+ \code{\link{filledshape}}, \code{\link{filledcylinder}},
+ \code{\link{filledellipse}}
+}
+
+\keyword{aplot}
+
diff --git a/man/filledcylinder.Rd b/man/filledcylinder.Rd
new file mode 100644
index 0000000..3272ea3
--- /dev/null
+++ b/man/filledcylinder.Rd
@@ -0,0 +1,102 @@
+\name{filledcylinder}
+\alias{filledcylinder}
+\title{
+ adds a colored and rotated cylinder to a plot
+}
+
+\description{
+ adds a rotated and colored cylinder to a plot; color can be a palette
+}
+
+\usage{
+filledcylinder(rx = 1, ry = rx, len = 1, col = femmecol(100),
+ lcol = NA, lwd = 2, lcolint = NULL, ltyint = 1,
+ lwdint = lwd, mid = c(0,0), angle = 0, delt = 1,
+ dr = 0.01, topcol = NULL, botcol = NULL, ...)
+}
+
+\arguments{
+ \item{rx }{horizontal radius.
+ }
+ \item{ry }{vertical radius.
+ }
+ \item{len }{length.
+ }
+ \item{col }{color palette to be used; also allowed are two extremes
+ or one value.
+ }
+ \item{lcol }{line color on external surface.
+ }
+ \item{lwd }{only if lcol!=NA, width of external line.
+ }
+ \item{lcolint }{only if lcol!=NA, line color on internal (hidden) surface.
+ }
+ \item{ltyint }{only if lcol!=NA, line type on internal (hidden) surface.
+ }
+ \item{lwdint }{only if dlcol!=NA, line width on internal (hidden) surface.
+ }
+ \item{mid }{midpoint of cylinder.
+ }
+ \item{angle }{rotation angle, degrees.
+ }
+ \item{delt }{increase factor, from left to right.
+ }
+ \item{dr }{size of segments, in radians, to draw top/bottom ellipse
+ (decrease for smoother).
+ }
+ \item{topcol }{color (palette) of top (right) surface.
+ }
+ \item{botcol }{color (palette) of bottom (left) surface.
+ }
+ \item{... }{arguments passed to function \link{filledellipse}.
+ }
+}
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+emptyplot(c(-1.2, 1.2), c(-1, 1), main = "filledcylinder")
+col <- c(rev(greycol(n = 50)), greycol(n = 50))
+col2 <- shadepalette("red", "blue", n = 50)
+col3 <- shadepalette("yellow", "black", n = 50)
+filledcylinder(rx = 0., ry = 0.2, len = 0.25, angle = 0, col = col,
+ mid = c(-1, 0), topcol = col[25])
+filledcylinder(rx = 0., ry = 0.2, angle = 90, col = col,
+ mid = c(-0.5, 0), topcol = col[25])
+filledcylinder(rx = 0.1, ry = 0.2, angle = 90, col = c(col2, rev(col2)),
+ mid = c(0.45, 0), topcol = col2[25])
+filledcylinder(rx = 0.05, ry = 0.2, angle = 90, col = c(col3, rev(col3)),
+ mid = c(0.9, 0), topcol = col3[25])
+filledcylinder(rx = 0.1, ry = 0.2, angle = 90, col = "white",
+ lcol = "black", lcolint = "grey")
+
+emptyplot(c(-1, 1), c(-1, 1), main = "filledcylinder")
+col <- shadepalette("blue", "black", n = 50)
+col2 <- shadepalette("red", "black", n = 50)
+col3 <- shadepalette("yellow", "black", n = 50)
+filledcylinder(rx = 0.025, ry = 0.2, angle = 90, col = c(col2, rev(col2)),
+ mid = c(-0.8, 0), topcol = col2[25], delt = -1, lcol = "black")
+filledcylinder(rx = 0.1, ry = 0.2, angle = 00, col = c(col, rev(col)),
+ mid = c(0.0, 0.0), topcol = col, delt = -1.2, lcol = "black")
+filledcylinder(rx = 0.075, ry = 0.2, angle = 90, col = c(col3, rev(col3)),
+ mid = c(0.8, 0), topcol = col3[25], delt = 0.0, lcol = "black")
+}
+
+\details{
+ When angle = 0 (the default), the cylinder is parallel to the x-axis
+
+ \code{rx} and \code{ry} are the horizontal and vertical radiusses of the
+ bordering ellipses.
+ Here "horizontal" and "vertical" denote the position BEFORE rotation
+
+ if \code{delt} > 1, the width of the cylinder will increase from left
+ to right.
+}
+
+\seealso{
+ \code{\link{filledellipse}}, \code{\link{filledshape}}
+}
+
+\keyword{aplot}
+
diff --git a/man/filledellipse.Rd b/man/filledellipse.Rd
new file mode 100644
index 0000000..63130cb
--- /dev/null
+++ b/man/filledellipse.Rd
@@ -0,0 +1,114 @@
+\name{filledellipse}
+\alias{filledellipse}
+\title{
+ adds a colored and rotated ellipse to a plot
+}
+
+\description{
+ plots (part of) outer and inner ellipses and colors inbetween;
+ color can be a palette
+}
+
+\usage{
+filledellipse(rx1 = 1, rx2 = 0, ry1 = rx1, ry2 = NULL, mid = c(0,0),
+ dr = 0.01, angle = 0, from = -pi, to = pi, col = femmecol(100),
+ values = NULL, zlim = NULL, lwd = 2, lcol = NA, ...)
+}
+\arguments{
+ \item{rx1 }{horizontal radius of outer ellipse.
+ }
+ \item{rx2 }{horizontal radius of inner ellipse.
+ }
+ \item{ry1 }{vertical radius of outer ellipse.
+ }
+ \item{ry2 }{vertical radius of inner ellipse.
+ }
+ \item{mid }{midpoint of ellipse.
+ }
+ \item{dr }{size of segments, in radians, to draw ellipse
+ (decrease for smoother).
+ }
+ \item{angle }{rotation angle, degrees.
+ }
+ \item{from }{starting angle for ellipse segment, radians.
+ }
+ \item{to }{final angle for ellipse segment, radians. The segment is drawn
+ counterclockwise. The default is draw a full ellipse.
+ }
+ \item{col }{color palette to be used; also allowed are two extremes
+ or one value.
+ }
+ \item{values }{if not \code{NULL}, a matrix providing (radius,z-values)
+ couples, used for coloring. .
+ }
+ \item{zlim }{Only if \code{values} is not \code{NULL}: the minimum and
+ maximum z values for which colors should be plotted, defaulting to the
+ range of the finite values of the second column of \code{values}.
+ }
+ \item{lwd }{width of external line.
+ }
+ \item{lcol }{line color.
+ }
+ \item{... }{arguments passed to R-function \link{polygon}.
+ }
+}
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+color <- greycol(50)
+dr <- 0.05
+emptyplot(xlim = c(-2, 2), ylim = c(-2, 2), col = color[length(color)],
+ main = "filledellipse")
+filledellipse(rx1 = 1, mid = c(1, 1) , dr = dr,
+ col = shadepalette(endcol = "darkblue"))
+filledellipse(rx1 = 1, ry1 = 0.5, mid = c(-1, -1), dr = dr, angle = 90,
+ col = shadepalette(endcol = "darkred"))
+filledellipse(rx1 = 1, ry1 = 0.5, rx2 = 0.5, dr = dr, mid = c(0, 0),
+ col = c(rev(color), color))
+filledellipse(rx1 = 0.5, mid = c(1, -1), dr = dr, from = pi, to = 1.5*pi,
+ col = rev(shadepalette(endcol = "black")))
+filledellipse(mid = c(-1, 1))
+
+emptyplot(xlim = c(-2, 2), ylim = c(-2, 2), main = "filledellipse")
+filledellipse(rx1 = 0.75, mid = c(-1, 1), col = greycol(100) , dr = dr,
+ values = cbind (1:100, (1:100)^0.5))
+filledellipse(rx1 = 0.75, mid = c(1, 1), col = greycol(100) , dr = dr,
+ values = cbind (1:100, (1:100)))
+filledellipse(rx1 = 0.75, mid = c(-1, -1), col = greycol(100), dr = dr,
+ values = cbind (1:100, (1:100)^2))
+filledellipse(rx1 = 0.75, mid = c(1, -1), col = greycol(100) , dr = dr,
+ values = cbind (1:100, (1:100)^5))
+}
+
+\details{
+ draws (part of) an outer and inner ellipse, as specified by inner and
+ outer radiusses:
+
+ \code{rx1},\code{ry1}: horizontal and vertical radiusses of outer ellipse;
+ \code{rx2},\code{ry2}: same for inner ellipse.
+ Here "horizontal" and "vertical" denote the position BEFORE rotation
+
+ Fills with a palette of colors inbetween
+
+ \code{values}: if not \code{NULL}, a matrix providing (radius,z-values)
+ couples, used for coloring.
+ Here radius are positive values denoting the relative distance between
+ the shapes centre and edge.
+ The radiusses are rescaled to be in [0,1] if needed.
+ z-values (2nd column of \code{values}) together with \code{zlim} and
+ \code{col} denote the coloration level.
+
+ Colors in \code{col} will be interpolated to the z-values and used to
+ color an interval as given by the input radiusses.
+
+ If \code{rx2}, the radius of the inner ellipse is 0, the ellipse is full.
+}
+
+\seealso{
+ \code{\link{filledshape}}, \code{\link{filledcylinder}}
+}
+
+\keyword{aplot}
+
diff --git a/man/filledmultigonal.Rd b/man/filledmultigonal.Rd
new file mode 100644
index 0000000..bd31b4a
--- /dev/null
+++ b/man/filledmultigonal.Rd
@@ -0,0 +1,112 @@
+\name{filledmultigonal}
+\alias{filledmultigonal}
+
+\title{
+ adds a colored and rotated multigonal shape to a plot
+}
+
+\description{
+ draws and colors a rotated shape with equal-sized vertices ;
+ color can be a palette.
+}
+
+\usage{
+filledmultigonal(mid = c(0, 0), rx = 1, ry = rx, nr = 4,
+ col = femmecol(100), values = NULL,
+ zlim = NULL, lwd = 2, lcol = NA, angle = 0, ...)
+}
+\arguments{
+ \item{mid }{midpoint of multigonal.
+ }
+ \item{rx }{horizontal radius.
+ }
+ \item{ry }{vertical radius.
+ }
+ \item{nr }{number of sides.
+ }
+ \item{col }{
+ color palette to be used; also allowed are two extremes or one value.
+ }
+ \item{values }{if not \code{NULL}, a matrix providing (radius,z-values)
+ couples, used for coloring.
+ }
+ \item{zlim }{Only if \code{values} is not \code{NULL}: the minimum and
+ maximum z values for which colors should be plotted,
+ defaulting to the range of the finite values of the second column of
+ \code{values}.
+ }
+ \item{lwd }{width of external line.
+ }
+ \item{lcol }{line color.
+ }
+ \item{angle }{angle of rotation, in degrees.
+ }
+ \item{... }{arguments passed to R-function \link{polygon}.
+ }
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+emptyplot(c(-1, 1), main = "filledmultigonal")
+
+filledmultigonal(rx = 0.25, ry = 0.125, nr = 3, mid = c(-0.75, 0.75),
+ angle = 45, col = shadepalette("red", "blue", n = 50))
+filledmultigonal(rx = 0.125, ry = 0.25, nr = 3, mid = c(-0.25, 0.75),
+ col = shadepalette("red", "yellow", n = 50))
+filledmultigonal(rx = 0.25, ry = 0.25 , nr = 3, mid = c(0.25, 0.75),
+ col = c("red", "orange"))
+filledmultigonal(rx = 0.25, ry = 0.25 , nr = 3, mid = c(0.75, 0.75),
+ angle = 90, col = "red")
+
+filledmultigonal(rx = 0.25, ry = 0.25, nr = 4, mid = c(-0.75, 0.25),
+ angle = 0, col = shadepalette("red", "blue", n = 50))
+filledmultigonal(rx = 0.25, ry = 0.25, nr = 4, mid = c(-0.25, 0.25),
+ angle = 45, col = shadepalette("red", "blue", n = 50))
+filledmultigonal(rx = 0.25, ry = 0.125, nr = 4, mid = c(0.25, 0.25),
+ angle = 0, col = shadepalette("red", "blue", n = 50))
+filledmultigonal(rx = 0.25, ry = 0.125, nr = 4, mid = c(0.75, 0.25),
+ angle = 45, col = shadepalette("red", "blue", n = 50))
+
+filledmultigonal(rx = 0.25, ry = 0.25, nr = 5, mid = c(-0.75, -0.25),
+ angle = 0, col = shadepalette("darkgreen", "lightgreen", n = 50))
+filledmultigonal(rx = 0.25, angle = 0, nr = 5, mid = c(-0.25, -0.25),
+ col = rainbow(50))
+filledmultigonal(rx = 0.25, angle = 30, nr = 6, mid = c(0.25, -0.25),
+ col = femmecol(50))
+filledmultigonal(rx = 0.25, ry = 0.125, angle = 30, nr = 6, mid = c(0.75, -0.25),
+ col = "black")
+
+filledmultigonal(rx = 0.25, col = "darkblue", nr = 7, mid = c(-0.75, -0.75))
+filledmultigonal(rx = 0.25, col = "darkblue", nr = 9, mid = c(-0.25, -0.75))
+filledmultigonal(rx = 0.25, col = "darkblue", nr = 3.7, mid = c(0.25, -0.75))
+filledmultigonal(rx = 0.25, col = "darkblue", nr = 4.5, mid = c(0.75, -0.75))
+}
+
+\details{
+ Coloration proceeds from midpoint to external edge
+
+ \code{rx},\code{ry}: horizontal and vertical radiusses of the shape.
+ Here "horizontal" and "vertical" denote the position BEFORE rotation
+
+ \code{values}: if not \code{NULL}, a matrix providing (radius,z-values)
+ couples, used for coloring.
+ Here radius are positive values denoting the relative distance between
+ the shapes centre and edge.
+ The radiusses are rescaled to be in [0,1] if needed.
+ z-values (2nd column of \code{values}) together with \code{zlim} and
+ \code{col} denote the coloration level.
+
+ Colors in \code{col} will be interpolated to the z-values and used to
+ color an interval as given by the input radiusses.
+}
+
+\seealso{
+ \code{\link{filledrectangle}}, \code{\link{filledshape}},
+ \code{\link{filledcylinder}}, \code{\link{filledellipse}}
+}
+
+\keyword{aplot}
+
diff --git a/man/filledrectangle.Rd b/man/filledrectangle.Rd
new file mode 100644
index 0000000..7a57459
--- /dev/null
+++ b/man/filledrectangle.Rd
@@ -0,0 +1,100 @@
+\name{filledrectangle}
+\alias{filledrectangle}
+
+\title{
+ adds a colored and rotated rectangle to a plot
+}
+
+\description{
+ plots and colors a rotated rectangle; color can be a palette
+}
+
+\usage{
+filledrectangle(mid = c(0, 0), wx = 1, wy = wx, col = femmecol(100),
+ values = NULL, zlim = NULL, lwd = 2, lcol = NA,
+ angle = 0, ...)
+}
+
+\arguments{
+ \item{mid }{midpoint of rectangle.
+ }
+ \item{wx }{horizontal width.
+ }
+ \item{wy }{vertical width.
+ }
+ \item{col }{color palette to be used; also allowed are two extremes or
+ one value.
+ }
+ \item{values }{ if not \code{NULL}, a matrix providing (radius,z-values)
+ couples, used for coloring.
+ }
+ \item{zlim }{ Only if values is not NULL: the minimum and maximum z values
+ for which colors should be plotted, defaulting to the range of the
+ finite values of the second column of \code{values}.
+ }
+ \item{lwd }{width of external line.
+ }
+ \item{lcol }{line color.
+ }
+ \item{angle }{angle of rotation, in degrees.
+ }
+ \item{... }{arguments passed to R-function \link{polygon}.
+ }
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+color <- shadepalette(grey(0.3), "lightblue", n = 50)
+emptyplot(main = "filledrectangle")
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0.5, 0.5), angle = 0)
+filledrectangle(wx = 0.25, wy = 0.25, col = "darkblue",
+ mid = c(0.5, 0.5), angle = 45)
+filledrectangle(wx = 0.125, wy = 0.125, col = c("lightblue","blue"),
+ mid = c(0.5, 0.5), angle = 90)
+
+color <- shadepalette(grey(0.3), "blue", n = 50)
+emptyplot(c(-1, 1), main = "filledrectangle")
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0, 0), angle = 0)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0.5, 0.5), angle = 90)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(-0.5, -0.5), angle = -90)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0.5, -0.5), angle = 180)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(-0.5, 0.5), angle = 270)
+}
+
+\details{
+ If \code{angle}=0, coloration starts from top to bottom. This is different
+ from \code{\link{filledmultigonal}},
+ where coloration proceeds from middle to external
+
+ \code{wx},\code{wy}: horizontal and vertical width of the shape
+ Here "horizontal" and "vertical" denote the position BEFORE rotation
+
+ \code{values}: if not \code{NULL}, a matrix providing (radius,z-values)
+ couples, used for coloring.
+ Here radius are positive values denoting the relative distance between
+ the shapes centre and edge.
+ The radiusses are rescaled to be in [0,1] if needed.
+ z-values (2nd column of \code{values}) together with \code{zlim} and
+ \code{col} denote the coloration level.
+
+ Colors in \code{col} will be interpolated to the z-values and used to
+ color an interval as given by the input radiusses.
+}
+\seealso{
+ \code{\link{filledmultigonal}}, \code{\link{filledshape}},
+ \code{\link{filledcylinder}}, \code{\link{filledellipse}}
+
+ \code{\link{polygon}}, \code{\link{rect}} for corresponding R-functions.
+}
+
+\keyword{aplot}
+
diff --git a/man/filledshape.Rd b/man/filledshape.Rd
new file mode 100644
index 0000000..400e04b
--- /dev/null
+++ b/man/filledshape.Rd
@@ -0,0 +1,98 @@
+\name{filledshape}
+\alias{filledshape}
+\title{
+ adds a colored shape to a plot
+}
+
+\description{
+ plots outer and inner shape and colors inbetween; color can be a palette
+}
+
+\usage{
+filledshape(xyouter, xyinner = colMeans(xyouter),
+ col = femmecol(100), values = NULL,
+ zlim = NULL, lcol = NA, lwd = 2, ...)
+}
+
+\arguments{
+ \item{xyouter }{2-column matrix with x,y values of outer shape.
+ }
+ \item{xyinner }{2-column matrix of 2-valued vector with x,y values of
+ inner shape; default is centroid of \code{xyouter}.
+ }
+ \item{col }{color palette to be used; also allowed are two extremes.
+ }
+ \item{values }{if not \code{NULL}, a matrix providing (radius,z-values)
+ couples, used for coloring.
+ }
+ \item{zlim }{ Only if \code{values} is not \code{NULL}: the minimum and
+ maximum z values for which colors should be plotted,
+ defaulting to the range of the finite values of the second column of
+ *values*.
+ }
+ \item{lcol }{line color.
+ }
+ \item{lwd }{width of external line, only if \code{lcol} != \code{NA}.
+ }
+ \item{... }{arguments passed to R-function \link{polygon}}
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+#an egg
+color <-greycol(100)
+emptyplot(c(-3.2, 3.2), col = color[length(color)], main = "filledshape")
+b <- 4
+a <- 9
+x <- seq(-sqrt(a), sqrt(a), by = 0.01)
+g <- b-b/a*x^2 - 0.2*b*x + 0.2*b/a*x^3
+g[g<0] <- 0
+x1 <- c(x, rev(x))
+g1 <- c(sqrt(g), rev(-sqrt(g)))
+xouter <- cbind(x1, g1)
+xouter <- rbind(xouter, xouter[1,])
+filledshape(xouter, xyinner = c(-1, 0), col = color)
+
+# a mill
+color <- shadepalette(grey(0.3), "yellow", n = 50)
+emptyplot(c(-3.3, 3.3), col = color[length(color)], main = "filledshape")
+x <- seq(0, 0.8*pi, pi/100)
+y <- sin(x)
+xouter <- cbind(x, y)
+
+for (i in seq(0, 360, 60))
+ xouter <- rbind(xouter, rotatexy(cbind(x, y), mid = c(0, 0), angle = i))
+filledshape(xouter, c(0, 0), col = color)
+
+# abstract art
+emptyplot(col = "darkgrey", main = "filledshape")
+filledshape(matrix(ncol = 2, runif(100)), col = "darkblue")
+}
+
+\details{
+ draws and outer and inner shape, as specified in \code{xyouter}, and
+ \code{xyinner} and fills with a palette of colors inbetween;
+
+ \code{values}: if not null, a matrix providing (radius,z-values) couples,
+ used for coloring.
+ Here radius are positive values denoting the relative distance between
+ the shapes centre and edge.
+ The radiusses are rescaled to be in [0,1] if needed.
+ z-values (2nd column of \code{values}) together with \code{zlim} and
+ \code{col} denote the coloration level.
+
+ Colors in \code{col} will be interpolated to the z-values and used to
+ color an interval as given by the input radiusses.
+
+ If \code{xyinner} is a point, the shape is full.
+}
+
+\seealso{
+ \code{\link{filledellipse}}, \code{\link{filledcylinder}}
+}
+
+\keyword{aplot}
+
diff --git a/man/getellipse.Rd b/man/getellipse.Rd
new file mode 100644
index 0000000..fee8059
--- /dev/null
+++ b/man/getellipse.Rd
@@ -0,0 +1,77 @@
+\name{getellipse}
+\alias{getellipse}
+\title{
+ x-y coordinates of ellipse
+}
+
+\description{
+ calculates x-y values for (part of) an ellipse; the ellipse can be rotated
+}
+
+\usage{
+getellipse(rx = 1, ry = rx, mid = c(0, 0), dr = 0.01,
+ angle = 0, from = -pi, to = pi)
+}
+
+\arguments{
+ \item{rx }{long radius of ellipse.
+ }
+ \item{ry }{short radius of ellipse.
+ }
+ \item{mid }{midpoint of ellipse.
+ }
+ \item{dr }{size of segments, in radians, to specify ellipse
+ (decrease for smoother).
+ }
+ \item{angle }{rotation angle, degrees.
+ }
+ \item{from }{starting angle for ellipse segment, radians.
+ }
+ \item{to }{final angle for ellipse segment, radians. The segment is generated
+ counterclockwise. The default is draw a full ellipse.
+ }
+}
+
+\value{
+ a 2-column matrix with x-y values of the ellipse
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+plot(getellipse(1, from = 0, to = pi/2), type = "l", col = "red",
+ lwd = 2, main = "getellipse")
+lines(getellipse(0.5, 0.25, mid = c(0.5, 0.5)), type = "l",
+ col = "blue", lwd = 2)
+lines(getellipse(0.5, 0.25, mid = c(0.5, 0.5), angle = 45),
+ type = "l", col = "green", lwd = 2)
+
+lines(getellipse(0.2, 0.2, mid = c(0.5, 0.5), from = 0, to = pi/2),
+ type = "l", col = "orange", lwd = 2)
+lines(getellipse(0.2, 0.2, mid = c(0.5, 0.5), from = pi/2, to = 0),
+ type = "l", col = "black", lwd = 2)
+lines(getellipse(0.1, 0.1, mid = c(0.75, 0.5), from = -pi/2, to = pi/2),
+ type = "l", col = "black", lwd = 2)
+
+emptyplot(main = "getellipse")
+col <- femmecol(90)
+for (i in seq(0, 180, by = 2))
+ lines(getellipse(0.5, 0.25, mid = c(0.5, 0.5), angle = i),
+ type = "l", col = col[(i/2)+1], lwd = 2)
+}
+
+\details{
+ \code{rx} and \code{ry} are the horizontal and vertical radiusses of the
+ ellipses.
+
+ points \code{from} and \code{to} are joined counterclockwise. (this has changed
+ since version 1.3.4).
+}
+\seealso{
+ \code{\link{plotellipse}}, \code{\link{filledellipse}}
+}
+
+\keyword{dplot}
+
diff --git a/man/greycol.Rd b/man/greycol.Rd
new file mode 100644
index 0000000..90d334b
--- /dev/null
+++ b/man/greycol.Rd
@@ -0,0 +1,46 @@
+\name{greycol}
+\alias{greycol}
+\alias{graycol}
+\title{
+ white-black color palette
+}
+
+\description{
+ Creates a vector of (n) contiguous colors from white/grey to black
+}
+
+\usage{
+greycol(n = 100, interval = c(0.0, 0.7))
+}
+
+\arguments{
+ \item{n }{number of colors.
+ }
+ \item{interval }{interval *to* where to interpolate.
+ }
+}
+\value{
+ a vector of character strings giving the colors in hexadecimal format.
+}
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+filled.contour(volcano, color = graycol, asp = 1, main = "greycol,graycol")
+graycol(10)
+image(matrix(nrow = 1, ncol = 100, data = 1:100),
+ col = graycol(100), main = "greycol,graycol")
+}
+
+\details{
+ greycol is an alias of graycol
+}
+
+\seealso{
+ \code{\link{rainbow}}, \code{\link{heat.colors}},
+ \code{\link{topo.colors}}, \code{\link{femmecol}}
+}
+
+\keyword{color}
+
diff --git a/man/intpalette.Rd b/man/intpalette.Rd
new file mode 100644
index 0000000..0b74ded
--- /dev/null
+++ b/man/intpalette.Rd
@@ -0,0 +1,56 @@
+\name{intpalette}
+\alias{intpalette}
+\title{color palettes}
+\description{
+ Returns color(s) that are a linear interpolation of a given set of colors.
+}
+
+\usage{
+intpalette(inputcol, numcol = length(x.to), x.from = NULL, x.to = NULL)
+}
+
+\arguments{
+ \item{inputcol }{initial colors, *from* where to interpolate.
+ }
+ \item{numcol }{number of colors to interpolate *to*.
+ }
+ \item{x.from }{x-values *from* where to interpolate.
+ }
+ \item{x.to }{x-values where to interpolate *to*.
+ }
+}
+
+\value{
+ a vector of character strings giving the interpolated colors in
+ hexadecimal format
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+intpalette(c("white", "black"), n = 10)
+grey(seq(1, 0, length.out = 10))
+image(matrix(nrow = 1,ncol = 100, data = 1:100),
+ col = intpalette(c("red", "blue"), numcol = 100),
+ main = "intpalette")
+image(matrix(nrow = 1, ncol = 100, data = 1:100),
+ col = intpalette(c("red", "blue", "yellow"), numcol = 100),
+ main = "intpalette")
+}
+
+\details{
+ Return value is a vector of *colors* in hexadecimal format.
+
+ This is different from \code{\link[grDevices]{colorRamp}}(R function),
+ that returns a *function*
+}
+
+\seealso{
+ \code{\link{greycol}}, \code{\link{femmecol}}, \code{\link{shadepalette}},
+ \code{\link[grDevices]{colorRamp}} for comparable R function
+}
+
+\keyword{color}
+
diff --git a/man/plotcircle.Rd b/man/plotcircle.Rd
new file mode 100644
index 0000000..0d755e0
--- /dev/null
+++ b/man/plotcircle.Rd
@@ -0,0 +1,58 @@
+\name{plotcircle}
+\alias{plotcircle}
+\title{
+ adds part of a colored circle to a plot
+}
+\description{
+ adds (part of) a colored circle to a plot;
+ an arrow can be drawn at a specified position
+}
+
+\usage{
+plotcircle(r = 1, ...)
+}
+
+\arguments{
+ \item{r }{radius of circle.
+ }
+ \item{... }{arguments passed to function \link{plotellipse}.
+ }
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+# symmetrical axes
+emptyplot(c(0, 1))
+plotcircle(mid = c(0.5, 0.5), r = 0.25, from = 0, to = 3*pi/2,
+ arrow = TRUE, arr.pos = 0.5, col = "red")
+# symmetrical
+plotellipse(mid = c(0.5, 0.5), rx = 0.2, ry = 0.2,
+ arrow = TRUE, arr.pos = 0.5, col = "blue")
+
+
+#non-symmetrical axes
+emptyplot(c(0, 1), c(0, 2), main = "plotcircle", asp = FALSE)
+plotcircle(mid = c(0.5, 0.5), r = 0.25, from = 0, to = 3*pi/2,
+ arrow = TRUE, arr.pos = 0.5, col = "red")
+plotellipse(mid = c(0.5, 0.5), rx = 0.25, ry = 0.25,
+ arrow = TRUE, arr.pos = 0.5, col = "blue")
+}
+
+\details{
+ \code{plotcircle} calls \code{plotellipse}, making sure that the figure
+ drawn effectively looks like a circle.
+ For graphs that have both axes of equal size, the circle will be equal
+ to the ellipse with equal rx and ry. See second example
+
+ see \code{\link{plotellipse}} for details
+}
+
+\seealso{
+ \code{\link{plotellipse}} to draw ellipses
+}
+
+\keyword{aplot}
+
diff --git a/man/plotellipse.Rd b/man/plotellipse.Rd
new file mode 100644
index 0000000..2469509
--- /dev/null
+++ b/man/plotellipse.Rd
@@ -0,0 +1,117 @@
+\name{plotellipse}
+\alias{plotellipse}
+\title{
+ adds part of a colored and rotated ellipse to a plot
+}
+\description{
+ adds (part of) a colored, and rotated ellipse to a plot;
+ an arrow can be drawn at a specified position.
+}
+\usage{
+plotellipse(rx = 1, ry = 0.2, mid = c(0,0), dr = 0.01,
+ angle = 0, from = -pi, to = pi, type = "l", lwd = 2,
+ lcol = "black", col = NULL, arrow = FALSE,
+ arr.length = 0.4, arr.width = arr.length*0.5,
+ arr.type = "curved", arr.pos = 1, arr.code = 2,
+ arr.adj = 0.5, arr.col = "black", ...)
+}
+
+\arguments{
+ \item{rx }{long radius of ellipse.
+ }
+ \item{ry }{short radius of ellipse.
+ }
+ \item{mid }{midpoint of ellipse.
+ }
+ \item{dr }{size of segments, in radians, to draw ellipse
+ (decrease for smoother).
+ }
+ \item{angle }{rotation angle, degrees.
+ }
+ \item{from }{starting angle for ellipse segment, radians.
+ }
+ \item{to }{final angle for ellipse segment, radians.
+ }
+ \item{type }{external line or points; "n" if no line.
+ }
+ \item{lwd }{width of external line.
+ }
+ \item{lcol }{line color.
+ }
+ \item{col }{fill color.
+ }
+ \item{arrow }{drawing arrowhead yes/no.
+ }
+ \item{arr.length }{length of arrowhead.
+ }
+ \item{arr.width }{width of arrowhead.
+ }
+ \item{arr.type }{type of arrow.
+ }
+ \item{arr.pos }{position of arrow, 0=start,1=end.
+ }
+ \item{arr.code }{integer code determining kind of arrows to draw.
+ }
+ \item{arr.adj }{adjustment of arrow.
+ }
+ \item{arr.col }{color of arrow head.
+ }
+ \item{... }{arguments passed to R-function \link{lines}.
+ }
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+emptyplot(c(-1, 1), main = "plotellipse")
+plotellipse(rx = 0.8, ry = 0.3, angle = 60, col = "blue")
+plotellipse(rx = 1.0, ry = 0.6, angle = 0, from = pi, to = 2*pi,
+ arrow = TRUE, arr.pos = seq(0.1, 0.5, by = 0.1),
+ arr.col = rainbow(5))
+plotellipse(rx = 1.0, ry = 0.6, angle = 30, from = pi, to = 1.2*pi,
+ col = "red")
+plotellipse(rx = 0.1, ry = 0.6, from = 1.5*pi, to = pi,
+ lcol = "orange", mid = c(0.2,0.2))
+plotellipse(rx = 0.1, ry = 0.6, angle = 30, from = 1.5*pi, to = pi,
+ lcol = "orange", mid = c(0.2,0.2))
+}
+
+\details{
+ \code{rx} and \code{ry} are the horizontal and vertical radiusses of the
+ ellipses.
+
+ The ellipse is drawn from the point defined by \code{from} to the point defined
+ as \code{to} which are joined anti-clockwise.
+
+ if \code{arrow} is \code{TRUE}, an arrow is drawn along the path of the
+ ellipse.
+
+ \code{arr.length} and \code{arr.width} set the size of the arrow.
+
+ The type of the arrowhead is set with \code{arr.type} which can take
+ the values:
+ \itemize{
+ \item "simple" : uses comparable \R function \link{arrows}.
+ \item "triangle": uses filled triangle.
+ \item "curved" : draws arrowhead with curved edges.
+ \item "circle" : draws circular head.
+ }
+ \code{arr.pos}, a real value between 0 and 1 gives the position
+ (0=start,1=end).
+
+ \code{arr.col} specifies the color, \code{arr.code} specifies where the
+ angle points to.
+
+ \code{arr.adj} specifies the position adjustment - see \code{\link{Arrows}}
+ for details.
+}
+
+\seealso{
+ \code{\link{getellipse}}, \code{\link{filledellipse}},
+ \code{\link{plotcircle}}.
+}
+
+\keyword{aplot}
+
diff --git a/man/rotatexy.Rd b/man/rotatexy.Rd
new file mode 100644
index 0000000..f75d8cd
--- /dev/null
+++ b/man/rotatexy.Rd
@@ -0,0 +1,55 @@
+\name{rotatexy}
+\alias{rotatexy}
+\title{
+ rotates 2-column matrix around a midpoint
+}
+
+\description{
+ rotates xy values around a midpoint;
+ xy is either a 2-columned matrix or a 2-valued vector
+}
+
+\usage{
+rotatexy(xy, angle, mid = colMeans(xy), asp = FALSE)
+}
+
+\arguments{
+ \item{xy }{matrix with 2 columns, or a 2-valued vector to be rotated.
+ }
+ \item{angle }{angle of rotation, in degrees.
+ }
+ \item{mid }{rotation point, default=centroid.
+ }
+ \item{asp }{if true: aspect ratio is kept.
+ }
+}
+\value{
+ a 2-column matrix with rotated values
+}
+
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+x <- seq(0, 2*pi, pi/100)
+y <- sin(x)
+cols <- intpalette(c("blue", "green", "yellow", "red"), n = 500)
+cols <- c(cols,rev(cols))
+plot(x, y, type = "l", ylim = c(-3, 3), main = "rotatexy",
+ col = cols[1], lwd = 2)
+for (i in 2:1000)
+ lines(rotatexy( cbind(x, y), angle = 0.18*i),
+ col = cols[i], lwd = 2)
+
+cols <- femmecol(1000)
+plot(x, y, xlim = c(-1, 1), ylim = c(-1, 1), main = "rotatexy",
+ col = cols[1], type = "n")
+for (i in 2:1000) {
+ xy <- rotatexy(c(0, 1), angle = 0.36*i, mid = c(0,0))
+ points(xy[1], xy[2], col = cols[i], pch = ".", cex = 2)
+}
+}
+
+\keyword{manip}
+
diff --git a/man/roundrect.Rd b/man/roundrect.Rd
new file mode 100644
index 0000000..eda5d68
--- /dev/null
+++ b/man/roundrect.Rd
@@ -0,0 +1,56 @@
+\name{roundrect}
+\alias{roundrect}
+\title{
+ adds a rounded rectangular box to a plot
+}
+\description{
+ adds a rectangular box with rounded left and right edges to a plot
+}
+
+\usage{
+roundrect(mid, radx, rady, rx = rady, dr = 0.01,
+ col = "white", lcol = "black", lwd = 2, angle = 0, ...)
+}
+\arguments{
+ \item{mid }{midpoint (x,y) of the box.
+ }
+ \item{radx }{horizontal radius of the box.
+ }
+ \item{rady }{vertical radius of the box.
+ }
+ \item{rx }{radius of rounded part.
+ }
+ \item{dr }{size of segments, in radians, to draw the rounded line
+ (decrease for smoother).
+ }
+ \item{col }{fill color of the box.
+ }
+ \item{lcol }{line color surrounding box.
+ }
+ \item{lwd }{line width of line surrounding the box.
+ }
+ \item{angle }{rotation angle, degrees.
+ }
+ \item{... }{arguments passed to function \link{filledshape}.
+ }
+}
+\author{Karline Soetaert <karline.soetaert at nioz.nl>}
+
+\examples{
+emptyplot(c(-0.1, 1.1), main = "roundrect")
+for (i in 1:10)
+ roundrect(mid = runif(2), col = i, radx = 0.1, rady = 0.05)
+for (i in 1:5)
+ roundrect(mid = runif(2), col = greycol(20), radx = 0.05,
+ rady = 0.05, angle = runif(1)*360)
+}
+\details{
+ \code{radx} and \code{rady} are the horizontal and vertical radiusses of
+ the box; \code{rx} is the horizontal radius of the rounded part.
+
+ Here \code{horizontal} and \code{vertical} denote the position BEFORE
+ rotation.
+}
+
+\keyword{aplot}
+
diff --git a/man/shadepalette.Rd b/man/shadepalette.Rd
new file mode 100644
index 0000000..0d67a31
--- /dev/null
+++ b/man/shadepalette.Rd
@@ -0,0 +1,43 @@
+\name{shadepalette}
+\alias{shadepalette}
+\title{
+ color palette inbetween two extremes
+}
+\description{
+ Returns color(s) that are a linear interpolation between two colors
+
+ these colors are suitable for shading shapes
+}
+\usage{
+shadepalette(n = 100, endcol = "red", inicol = "white",
+ interval = c(0.0, 1.0))
+}
+\arguments{
+ \item{n }{number of colors.
+ }
+ \item{endcol }{final color.
+ }
+ \item{inicol }{initial color.
+ }
+ \item{interval }{interval *to* where to interpolate.
+ }
+}
+\value{
+ a vector of character strings giving the interpolated colors in
+ hexadecimal format
+}
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+
+\examples{
+shadepalette(n = 10, "white", "black")
+image(matrix(nrow = 1, ncol = 100, data = 1:100),
+ col = shadepalette(100, "red", "blue"), main = "shadepalette")
+}
+\seealso{
+ \code{\link{intpalette}}, \code{\link{grey}}, \code{\link{femmecol}}
+ \code{\link[grDevices]{colorRamp}} for comparable R functions.
+}
+\keyword{color}
+
diff --git a/man/shape.Rd b/man/shape.Rd
new file mode 100644
index 0000000..18c2642
--- /dev/null
+++ b/man/shape.Rd
@@ -0,0 +1,67 @@
+\name{shape-package}
+\alias{shape-package}
+\alias{shape}
+\docType{package}
+\title{
+ Functions for plotting graphical shapes, colors
+}
+\description{
+ Functions for plotting graphical shapes
+ such as ellipses, circles, cylinders, arrows, ...
+
+ Support for the book "A practical guide to ecological modelling -
+ using R as a simulation platform"
+ by Karline Soetaert and Peter M.J. Herman (2009). Springer.
+}
+
+\details{
+ \tabular{ll}{
+ Package: \tab shape\cr
+ Type: \tab Package\cr
+ Version: \tab 1.3.4\cr
+ Date: \tab 2011-07-30\cr
+ License: \tab GNU Public License 3 or above\cr
+ }
+This package is used in R-package ecolMod, which includes many more examples.
+
+See also R-package diagram.
+
+Changes in version 1.3.4: more consistent drawing of ellipse and circle segments,
+(functions getellipse, getcircle), added textflag. (both suggested by Tom Wilson)
+}
+\author{
+ Karline Soetaert (Maintainer)
+}
+\seealso{
+ \code{\link{A4}}, \code{\link{writelabel}}, \code{\link{emptyplot}},
+ \code{\link{drapecol}}, \code{\link{femmecol}}, \code{\link{intpalette}},
+ \code{\link{shadepalette}}, \code{\link{colorlegend}},
+ \code{\link{greycol}}, \code{\link{rotatexy}}, \code{\link{Arrowhead}},
+ \code{\link{Arrows}}, \code{\link{cylindersegment}},
+ \code{\link{filledcylinder}}, \code{\link{filledcircle}},
+ \code{\link{filledellipse}}, \code{\link{filledmultigonal}},
+ \code{\link{filledrectangle}}, \code{\link{filledshape}},
+ \code{\link{getellipse}}, \code{\link{plotcircle}},
+ \code{\link{plotellipse}}, \code{\link{roundrect}}, \code{\link{textflag}}.
+}
+
+\examples{
+\dontrun{
+## show examples (see respective help pages for details)
+example(rotatexy)
+example(filledshape)
+
+## run demos
+demo("colorshapes") # creating colored shapes
+
+## open the directory with source code of demos
+browseURL(paste(system.file(package="shape"), "/demo", sep=""))
+
+## show package vignette
+vignette("shape")
+edit(vignette("shape"))
+browseURL(paste(system.file(package="shape"), "/doc", sep=""))
+}
+}
+
+\keyword{ package }
\ No newline at end of file
diff --git a/man/textflag.Rd b/man/textflag.Rd
new file mode 100644
index 0000000..b967201
--- /dev/null
+++ b/man/textflag.Rd
@@ -0,0 +1,75 @@
+\name{textflag}
+\alias{textflag}
+\title{
+ adds a filled rounded rectangular box with a text to a plot
+}
+\description{
+ adds a rectangular box with rounded left and right edges to a plot
+}
+
+\usage{
+textflag(mid, radx, rady, rx = rady, dr = 0.01,
+ col = femmecol(100), lcol = "white",
+ bcol = lcol, lwd = 2, angle = 0, lab = NULL,
+ leftright = TRUE, tcol = NULL, ...)
+}
+\arguments{
+ \item{mid }{midpoint (x,y) of the box.
+ }
+ \item{radx }{horizontal radius of the box.
+ }
+ \item{rady }{vertical radius of the box.
+ }
+ \item{rx }{radius of rounded part.
+ }
+ \item{dr }{size of segments, in radians, to draw the rounded line
+ (decrease for smoother).
+ }
+ \item{col }{fill color of the box; the box will be filled from left to right.
+ }
+ \item{lcol }{line color surrounding box.
+ }
+ \item{bcol }{line color to remove the ellipse from the rectangular box.
+ }
+ \item{tcol }{text color.
+ }
+ \item{lwd }{line width of line surrounding the box.
+ }
+ \item{angle }{rotation angle, degrees.
+ }
+ \item{lab }{one label or a vector string of labels to be added in box.
+ }
+ \item{leftright }{if \code{TRUE} then coloring is from left to right
+ else the coloring is from bottom to top box (for \code{angle} = 0).
+ }
+ \item{... }{other arguments passed to function \link{text}.
+ }
+}
+\author{Karline Soetaert <karline.soetaert at nioz.nl>}
+
+\examples{
+emptyplot()
+textflag(mid = c(0.5, 0.5), radx = 0.5, rady = 0.1,
+ lcol = "white", lab = "hello", cex = 5, font = 2:3)
+
+textflag(mid = c(0.5, 0.15), radx = 0.5, rady = 0.1,
+ rx = 0.3,lcol = "black", lab = "hello 2", cex = 4,
+ font = 2, angle = 20, tcol = "darkblue")
+
+textflag(mid = c(0.5, 0.85), radx = 0.5, rady = 0.1, rx = 0.03,
+ lcol = "white", lab = "hello 3", cex = 4, font = 2,
+ leftright = FALSE)
+}
+\details{
+ \code{radx} and \code{rady} are the horizontal and vertical radiusses of
+ the box; \code{rx} is the horizontal radius of the rounded part.
+
+ Here \code{horizontal} and \code{vertical} denote the position BEFORE
+ rotation.
+
+ This function is similar to function \link{roundrect}, except that coloring
+ is from left to right.
+}
+
+\keyword{aplot}
+
diff --git a/man/writelabel.Rd b/man/writelabel.Rd
new file mode 100644
index 0000000..d130b30
--- /dev/null
+++ b/man/writelabel.Rd
@@ -0,0 +1,36 @@
+\name{writelabel}
+\alias{writelabel}
+\title{
+ adds a label next to a plot
+}
+\description{
+ adds one-character label on left-upper margin, next to a plot
+}
+\usage{
+writelabel(text = NULL, nr = 1, at = -0.1, line = 1, cex = 1.5, ...)
+}
+\arguments{
+ \item{text }{text to write.
+ }
+ \item{nr }{integer; if text = NULL: nr is converted to uppercase letter.
+ }
+ \item{at }{relative distance of label position, from left margin of
+ plot region.
+ }
+ \item{line }{line above the plot region of label position.
+ }
+ \item{cex }{relative size of label.
+ }
+ \item{... }{arguments passed to R-function \link{mtext}.
+ }
+}
+\author{
+ Karline Soetaert <karline.soetaert at nioz.nl>
+}
+\examples{
+plot(runif(2), main = "writelabel")
+writelabel("A")
+writelabel("B", at = 0)
+writelabel("C", at = 1)}
+\keyword{aplot}
+
diff --git a/vignettes/shape.Rnw b/vignettes/shape.Rnw
new file mode 100644
index 0000000..162e8ad
--- /dev/null
+++ b/vignettes/shape.Rnw
@@ -0,0 +1,440 @@
+\documentclass[article,nojss]{jss}
+\DeclareGraphicsExtensions{.pdf,.eps}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Add-on packages and fonts
+\usepackage{amsmath}
+\usepackage{xspace}
+\usepackage{verbatim}
+\usepackage[english]{babel}
+%\usepackage{mathptmx}
+%\usepackage{helvet}
+\usepackage[T1]{fontenc}
+\usepackage[latin1]{inputenc}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
+\newcommand{\di}{\textbf{\textsf{diagram}}\xspace}
+
+\title{\proglang{R} Package \pkg{shape}: functions for plotting graphical shapes, colors...}
+
+\Plaintitle{R Package shape: functions for plotting graphical shapes, colors...}
+
+\Keywords{graphics, shapes, colors, R}
+
+\Plainkeywords{graphics, shapes, colors, R}
+
+
+\author{Karline Soetaert\\
+Royal Netherlands Institute of Sea Research\\
+Yerseke, The Netherlands
+}
+
+\Plainauthor{Karline Soetaert}
+
+\Abstract{This document describes how to use the \pkg{shape} package
+for plotting graphical shapes.
+
+Together with R-package \pkg{diagram} \citep{diagram} this package has
+been written to produce the figures of the book \citep{Soetaertbook}
+
+}
+
+%% The address of (at least) one author should be given
+%% in the following format:
+\Address{
+ Karline Soetaert\\
+ Royal Netherlands Institute of Sea Research (NIOZ)\\
+ 4401 NT Yerseke, Netherlands
+ E-mail: \email{karline.soetaert at nioz.nl}\\
+ URL: \url{http://www.nioz.nl}\\
+}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% R/Sweave specific LaTeX commands.
+%% need no \usepackage{Sweave}
+%\VignetteIndexEntry{shape: functions for plotting graphical shapes}
+%\VignetteKeywords{graphics, shapes, colors}
+%\VignettePackage{shape}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Begin of the document
+\begin{document}
+\SweaveOpts{engine=R,eps=FALSE}
+\SweaveOpts{keep.source=TRUE}
+<<preliminaries,echo=FALSE,results=hide>>=
+library("shape")
+options(prompt = "> ")
+options(width=90)
+@
+
+\maketitle
+
+\section{Introduction}
+
+This vignette is the Sweave application of parts of demo
+\code{colorshapes} in package \pkg{shape} \citep{shape}.
+
+
+\section{colors}
+Although one can find similar functions in other packages (including the R
+base package \citep{R2008}),
+\pkg{shape} includes ways to generate color schemes;
+\begin{itemize}
+\item \code{intpalette} creates transitions
+between several colors;
+\item \code{shadepalette} creates a gradient between two colors,
+useful for shading (see below).
+\item \code{drapecol} drapes colors over a \code{persp} plot;
+\end{itemize}
+by default the red-blue-yellow (matlab-type) colors are used.
+The code below demonstrates these functions (Figure \ref{fig:s1})
+<<label=s1, include=FALSE>>=
+par(mfrow = c(2, 2))
+image(matrix(nrow = 1, ncol = 50, data = 1:50),
+ main = "intpalette",
+ col = intpalette(c("red", "blue", "yellow", "green", "black"),
+ numcol = 50))
+#
+shadepalette(n = 10, "white", "black")
+#
+image(matrix(nrow = 1, ncol = 50, data = 1:50),
+ col = shadepalette(50, "red", "blue"),
+ main = "shadepalette")
+#
+par(mar = c(0, 0, 0, 0))
+persp(volcano, theta = 135, phi = 30, col = drapecol(volcano),
+ main = "drapecol", border = NA)
+@
+\begin{figure}
+\begin{center}
+<<label=s1, fig=TRUE,echo=FALSE>>=
+<<s1>>
+@
+\end{center}
+\caption{Use of \code{intpalette}, \code{shadepalette} and \code{drapecol}}
+\label{fig:s1}
+\end{figure}
+
+\section{Rotating}
+Function \code{rotatexy} rotates graphical shapes; it can be used to generate
+strangely-colored shapes (Figure \ref{fig:s2}).
+<<label=s2, include=FALSE>>=
+par(mfrow = c(2, 2), mar = c(3, 3, 3, 3))
+#
+# rotating points on a line
+#
+xy <- matrix(ncol = 2, data = c(1:5, rep(1, 5)))
+plot(xy, xlim = c(-6, 6), ylim = c(-6, 6), type = "b",
+ pch = 16, main = "rotatexy", col = 1)
+for (i in 1:5)
+ points(rotatexy(xy, mid = c(0, 0), angle = 60*i),
+ col = i+1, type = "b", pch = 16)
+points(0, 0, cex = 2, pch = 22, bg = "black")
+legend("topright", legend = 60*(0:5), col = 1:6, pch = 16,
+ title = "angle")
+legend("topleft", legend = "midpoint", pt.bg = "black",
+ pt.cex = 2, pch = 22, box.lty = 0)
+#
+# rotating lines..
+#
+x <- seq(0, 2*pi, pi/20)
+y <- sin(x)
+cols <- intpalette(c("blue", "green", "yellow", "red"), n = 125)
+cols <- c(cols, rev(cols))
+plot(x, y, type = "l", ylim = c(-3, 3), main = "rotatexy",
+ col = cols[1], lwd = 2, xlim = c(-1, 7))
+for (i in 2:250)
+ lines(rotatexy(cbind(x, y), angle = 0.72*i), col = cols[i], lwd = 2)
+#
+#
+x <- seq(0, 2*pi, pi/20)
+y <- sin(x*2)
+cols <- intpalette(c("red", "yellow", "black"), n = 125)
+cols <- c(cols, rev(cols))
+plot(x, y, type = "l", ylim = c(-4, 5), main = "rotatexy,
+ asp = TRUE", col = cols[1], lwd = 2, xlim = c(-1, 7))
+for (i in 2:250)
+ lines(rotatexy(cbind(x, y), angle = 0.72*i, asp = TRUE),
+ col = cols[i], lwd = 2)
+#
+# rotating points
+#
+cols <- femmecol(500)
+plot(x, y, xlim = c(-1, 1), ylim = c(-1, 1), main = "rotatexy",
+ col = cols[1], type = "n")
+for (i in 2:500) {
+ xy <- rotatexy(c(0, 1), angle = 0.72*i, mid = c(0, 0))
+ points(xy[1], xy[2], col = cols[i], pch = ".", cex = 2)
+}
+
+@
+\begin{figure}
+\begin{center}
+<<label=s2,fig=TRUE,echo=FALSE>>=
+<<s2>>
+@
+\end{center}
+\caption{Four examples of \code{rotatexy}}
+\label{fig:s2}
+\end{figure}
+
+\section{ellipses}
+If a suitable shading color is used, function \code{filledellipse} creates spheres,
+ellipses, donuts with 3-D appearance (Figure \ref{fig:s3}).
+<<label=s3, include=FALSE>>=
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+emptyplot(c(-1, 1))
+col <- c(rev(greycol(n = 30)), greycol(30))
+filledellipse(rx1 = 1, rx2 = 0.5, dr = 0.1, col = col)
+title("filledellipse")
+#
+emptyplot(c(-1, 1), c(-1, 1))
+filledellipse(col = col, dr = 0.1)
+title("filledellipse")
+#
+color <-gray(seq(1, 0.3, length.out = 30))
+emptyplot(xlim = c(-2, 2), ylim = c(-2, 2), col = color[length(color)])
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = 45, dr = 0.1)
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = -45, dr = 0.1)
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = 0, dr = 0.1)
+filledellipse(rx1 = 2, ry1 = 0.4, col = color, angle = 90, dr = 0.1)
+title("filledellipse")
+#
+emptyplot(main = "getellipse")
+col <-femmecol(90)
+for (i in seq(0, 180, by = 2))
+ lines(getellipse(0.5, 0.25, mid = c(0.5, 0.5), angle = i, dr = 0.1),
+ type = "l", col = col[(i/2)+1], lwd = 2)
+@
+\begin{figure}
+\begin{center}
+<<label=s3, fig=TRUE, echo=FALSE>>=
+<<s3>>
+@
+\end{center}
+\caption{Use of \code{filledellipse}, and \code{getellipse}}
+\label{fig:s3}
+\end{figure}
+
+\section{Cylinders, rectangles, multigonals}
+The code below draws cylinders, rectangles and multigonals (Figure \ref{fig:s4}).
+<<label=s4, include=FALSE>>=
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+#
+# simple cylinders
+emptyplot(c(-1.2, 1.2), c(-1, 1), main = "filledcylinder")
+col <- c(rev(greycol(n = 20)), greycol(n = 20))
+col2 <- shadepalette("red", "blue", n = 20)
+col3 <- shadepalette("yellow", "black", n = 20)
+filledcylinder(rx = 0., ry = 0.2, len = 0.25, angle = 0,
+ col = col, mid = c(-1, 0), dr = 0.1)
+filledcylinder(rx = 0.0, ry = 0.2, angle = 90, col = col,
+ mid = c(-0.5, 0), dr = 0.1)
+filledcylinder(rx = 0.1, ry = 0.2, angle = 90, col = c(col2, rev(col2)),
+ mid = c(0.45, 0), topcol = col2[10], dr = 0.1)
+filledcylinder(rx = 0.05, ry = 0.2, angle = 90, col = c(col3, rev(col3)),
+ mid = c(0.9, 0), topcol = col3[10], dr = 0.1)
+filledcylinder(rx = 0.1, ry = 0.2, angle = 90, col = "white",
+ lcol = "black", lcolint = "grey", dr = 0.1)
+#
+# more complex cylinders
+emptyplot(c(-1, 1), c(-1, 1), main = "filledcylinder")
+col <- shadepalette("blue", "black", n = 20)
+col2 <- shadepalette("red", "black", n = 20)
+col3 <- shadepalette("yellow", "black", n = 20)
+filledcylinder(rx = 0.025, ry = 0.2, angle = 90,
+ col = c(col2, rev(col2)), dr = 0.1, mid = c(-0.8, 0),
+ topcol = col2[10], delt = -1., lcol = "black")
+filledcylinder(rx = 0.1, ry = 0.2, angle = 00,
+ col = c(col, rev(col)), dr = 0.1, mid = c(0.0, 0.0),
+ topcol = col, delt = -1.2, lcol = "black")
+filledcylinder(rx = 0.075, ry = 0.2, angle = 90,
+ col = c(col3, rev(col3)), dr = 0.1, mid = c(0.8, 0),
+ topcol = col3[10], delt = 0.0, lcol = "black")
+#
+# rectangles
+color <- shadepalette(grey(0.3), "blue", n = 20)
+emptyplot(c(-1, 1), main = "filledrectangle")
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0, 0), angle = 0)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0.5, 0.5), angle = 90)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(-0.5, -0.5), angle = -90)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(0.5, -0.5), angle = 180)
+filledrectangle(wx = 0.5, wy = 0.5, col = color,
+ mid = c(-0.5, 0.5), angle = 270)
+#
+# multigonal
+color <- shadepalette(grey(0.3), "blue", n = 20)
+emptyplot(c(-1, 1))
+filledmultigonal(rx = 0.25, ry = 0.25,
+ col = shadepalette(grey(0.3), "blue", n = 20),
+ nr = 3, mid = c(0, 0), angle = 0)
+filledmultigonal(rx = 0.25, ry = 0.25,
+ col = shadepalette(grey(0.3), "darkgreen", n = 20),
+ nr = 4, mid = c(0.5, 0.5), angle = 90)
+filledmultigonal(rx = 0.25, ry = 0.25,
+ col = shadepalette(grey(0.3), "orange", n = 20),
+ nr = 5, mid = c(-0.5, -0.5), angle = -90)
+filledmultigonal(rx = 0.25, ry = 0.25, col = "black",
+ nr = 6, mid = c(0.5, -0.5), angle = 180)
+filledmultigonal(rx = 0.25, ry = 0.25, col = "white", lcol = "black",
+ nr = 7, mid = c(-0.5, 0.5), angle = 270)
+title("filledmultigonal")
+
+@
+\begin{figure}
+\begin{center}
+<<label = s4, fig = TRUE,echo = FALSE>>=
+<<s4>>
+@
+\end{center}
+\caption{Use of \code{filledcylinder}, \code{filledrectangle} and
+ \code{filledmultigonal}}
+\label{fig:s4}
+\end{figure}
+\section{Other shapes}
+Function \code{filledshape} is the most flexible drawing function from
+ \pkg{shape}: just specify an inner and outer shape and
+ fill with a color scheme (Figure \ref{fig:s5}).
+<<label = s5, include = FALSE>>=
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+#an egg
+color <- greycol(30)
+emptyplot(c(-3.2, 3.2), col = color[length(color)],
+ main = "filledshape")
+b <- 4
+a <- 9
+x <- seq(-sqrt(a), sqrt(a), by = 0.1)
+g <- b-b/a*x^2-0.2*b*x+0.2*b/a*x^3
+g[g<0] <- 0
+x1 <- c(x, rev(x))
+g1 <- c(sqrt(g), rev(-sqrt(g)))
+xouter <- cbind(x1, g1)
+xouter <- rbind(xouter, xouter[1, ])
+filledshape(xouter, xyinner = c(-1, 0), col = color)
+#
+# a mill
+color <- shadepalette(grey(0.3), "yellow", n = 20)
+emptyplot(c(-3.3, 3.3), col = color[length(color)],
+ main = "filledshape")
+x <- seq(0, 0.8*pi, pi/20)
+y <- sin(x)
+xouter <- cbind(x, y)
+for (i in seq(0, 360, 60))
+ xouter <- rbind(xouter,
+ rotatexy(cbind(x, y), mid = c(0, 0), angle = i))
+filledshape(xouter, c(0, 0), col = color)
+#
+# abstract art
+emptyplot(col = "darkgrey", main = "filledshape")
+filledshape(matrix(nc = 2, runif(80)), col = "darkblue")
+#
+emptyplot(col = "darkgrey", main = "filledshape")
+filledshape(matrix(nc = 2, runif(80)),
+ col = shadepalette(20, "darkred", "darkblue"))
+@
+\begin{figure}
+\begin{center}
+<<label = s5, fig=TRUE, echo=FALSE>>=
+<<s5>>
+@
+\end{center}
+\caption{Use of \code{filledshape}}
+\label{fig:s5}
+\end{figure}
+
+\section{arrows, arrowheads}
+As the arrow heads in the R base package are too simple for some applications,
+there are some improved arrow heads in \pkg{shape} (Figure \ref{fig:s6}).
+<<label = s6, include=FALSE>>=
+par(mfrow = c(2, 2), mar = c(2, 2, 2, 2))
+xlim <- c(-5 , 5)
+ylim <- c(-10, 10)
+x0<-runif(100, xlim[1], xlim[2])
+y0<-runif(100, ylim[1], ylim[2])
+x1<-x0+runif(100, -2, 2)
+y1<-y0+runif(100, -2, 2)
+size <- 0.4
+plot(0, type = "n", xlim = xlim, ylim = ylim)
+Arrows(x0, y0, x1, y1, arr.length = size, arr.type = "triangle",
+ arr.col = rainbow(runif(100, 1, 20)))
+title("Arrows")
+#
+# arrow heads
+#
+ang <- runif(100, -360, 360)
+plot(0, type = "n", xlim = xlim, ylim = ylim)
+Arrowhead(x0, y0, ang, arr.length = size, arr.type = "curved",
+ arr.col = rainbow(runif(100, 1, 20)))
+title("Arrowhead")
+#
+# Lotka-Volterra competition model
+#
+r1 <- 3 # parameters
+r2 <- 2
+K1 <- 1.5
+K2 <- 2
+alf12 <- 1
+alf21 <- 2
+
+xlim <- c(0, 1.5)
+ylim <- c(0, 2 )
+par(mar = c(5, 4, 4, 2))
+plot (0, type = "l", lwd = 3, # 1st isocline
+ main = "Lotka-Volterra competition",
+ xlab = "N1", ylab = "N2", xlim = xlim, ylim = ylim)
+
+gx <- seq(0, 1.5, len = 30)
+gy <- seq(0, 2, len = 30)
+N <- as.matrix(expand.grid(x = gx, y = gy))
+
+dN1 <- r1*N[, 1]*(1-(N[, 1]+alf12* N[, 2])/K1)
+dN2 <- r2*N[, 2]*(1-(N[, 2]+alf21* N[, 1])/K2)
+dt <- 0.01
+Arrows(N[, 1], N[, 2], N[, 1]+dt*dN1, N[, 2]+dt*dN2, arr.len = 0.08,
+ lcol = "darkblue", arr.type = "triangle")
+points(x = c(0, 0, 1.5, 0.5), y = c(0, 2, 0, 1), pch = 22, cex = 2,
+ bg = c("white", "black", "black", "grey"))
+
+@
+\begin{figure}
+\begin{center}
+<<label = s6, fig=TRUE,echo=FALSE>>=
+<<s6>>
+@
+\end{center}
+\caption{Use of \code{Arrows} and \code{Arrowhead} }
+\label{fig:s6}
+\end{figure}
+
+\section{Miscellaneous}
+Since version 1.3.4, function \code{textflag} has been added.
+<<label = textflag, include=FALSE>>=
+emptyplot()
+textflag(mid = c(0.5, 0.5), radx = 0.5, rady = 0.2,
+ lcol = "white", lab = "hello", cex = 5, font = 2:3)
+@
+\setkeys{Gin}{width=0.8\textwidth}
+\begin{figure}[ht]
+\begin{center}
+<<label = textflag, fig=TRUE,echo=FALSE, width = 12, height = 6>>=
+<<textflag>>
+@
+\end{center}
+\caption{Use of function \code{textflag} }
+\label{fig:textflag}
+\end{figure}
+\section{And finally}
+
+This vignette was created using Sweave \citep{Leisch02}.
+
+The package is on CRAN, the R-archive website (\citep{R2008})
+
+More examples can be found in the demo's of package \pkg{ecolMod} \citep{ecolMod}
+
+\bibliography{vignettes}
+
+\end{document}
+
diff --git a/vignettes/vignettes.bib b/vignettes/vignettes.bib
new file mode 100644
index 0000000..4232e6b
--- /dev/null
+++ b/vignettes/vignettes.bib
@@ -0,0 +1,87 @@
+ at ARTICLE{Niquil98,
+ author = {Niquil, N and Jackson, GA and Legendre, L and Delesalle, B},
+ title = {Inverse model analysis of the planktonic food web of Takapoto Atoll (French Polynesia).},
+ journal = {Marine Ecology Progress Series},
+ year = {1998},
+ volume = {165},
+ pages = {17--29},
+}
+ at ARTICLE{Donali99,
+ author = {Donali, E. and Olli, K. and Heiskanen, A.-S. and Andersen, T.},
+ title = {Carbon flow patterns in the planktonic food web of the Gulf of Riga, the Baltic Sea: a reconstruction by the inverse method},
+ journal = {Journal of Marine Systems},
+ volume={23},
+ pages={251-268},
+ year = {1999}
+}
+ at BOOK{Soetaertbook,
+ title = {A Practical Guide to Ecological Modelling. Using R as a Simulation Platform},
+ publisher = {Springer},
+ year = {2009},
+ author = {Soetaert, K and Herman, P M J},
+ pages = {372},
+ note = {ISBN 978-1-4020-8623-6},
+
+}
+ at BOOK{Caswell01,
+ author = {Caswell, H},
+ year={2001},
+ title={Matrix population models: construction, analysis, and interpretation},
+ edition={Second edition},
+ publisher={Sinauer, Sunderland}
+}
+ at MANUAL{R2008,
+ title = {\proglang{R}: A Language and Environment for Statistical Computing},
+ author = {{R Development Core Team}},
+ organization = {R Foundation for Statistical Computing},
+ address = {Vienna, Austria},
+ year = {2008},
+ note = {{ISBN} 3-900051-07-0},
+ url = {http://www.R-project.org}
+}
+ at inproceedings{Leisch02,
+ author = {Friedrich Leisch},
+ title = {Sweave: Dynamic Generation of Statistical Reports Using
+ Literate Data Analysis},
+ booktitle = {Compstat 2002 --- Proceedings in Computational
+ Statistics},
+ pages = {575--580},
+ year = 2002,
+ editor = {Wolfgang H{\"a}rdle and Bernd R{\"o}nz},
+ publisher = {Physica Verlag, Heidelberg},
+ note = {ISBN 3-7908-1517-9},
+ url = {http://www.stat.uni-muenchen.de/~leisch/Sweave}
+}
+
+ @Manual{limSolve,
+ title = {limSolve: Solving linear inverse models},
+ author = {Karline Soetaert and Van den Meersche, Karel and Dick van Oevelen},
+ year = {2009},
+ note = {R package version 1.5},
+ }
+ @Manual{LIM,
+ title = {LIM: Linear Inverse Modelling},
+ author = {Karline Soetaert and Dick van Oevelen},
+ year = {2009},
+ note = {R package version 1.3},
+ }
+ @Manual{diagram,
+ title = {diagram: Functions for visualising simple graphs (networks), plotting
+flow diagrams},
+ author = {Karline Soetaert},
+ year = {2009},
+ note = {R package version 1.4},
+ }
+ @Manual{ecolMod,
+ title = {ecolMod: "A practical guide to ecological modelling - using R as a
+simulation platform"},
+ author = {Karline Soetaert and Peter MJ Herman},
+ year = {2008},
+ note = {R package version 1.1},
+ }
+ @Manual{shape,
+ title = {shape: Functions for plotting graphical shapes, colors},
+ author = {Karline Soetaert},
+ year = {2009},
+ note = {R package version 1.2.2},
+ }
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-shape.git
More information about the debian-med-commit
mailing list