[scatterplot3d] 01/03: New upstream version 0.3-40
Philip Rinn
rinni-guest at moszumanska.debian.org
Wed Jun 14 13:29:40 UTC 2017
This is an automated email from the git hooks/post-receive script.
rinni-guest pushed a commit to branch master
in repository scatterplot3d.
commit 623f3e4e33f1fcb9d02a93d8db86518ddce23ffe
Author: Philip Rinn <rinni at inventati.org>
Date: Wed Jun 14 15:13:23 2017 +0200
New upstream version 0.3-40
---
CHANGES | 4 +++
DESCRIPTION | 8 ++---
MD5 | 14 ++++-----
NAMESPACE | 2 +-
R/scatterplot3d.R | 83 ++++++++++++++++++++++++++++++++++++++-------------
build/vignette.rds | Bin 235 -> 235 bytes
inst/doc/s3d.pdf | Bin 421379 -> 283710 bytes
man/scatterplot3d.Rd | 18 ++++++++---
8 files changed, 93 insertions(+), 36 deletions(-)
diff --git a/CHANGES b/CHANGES
index 1416aba..332ff74 100644
--- a/CHANGES
+++ b/CHANGES
@@ -68,6 +68,10 @@ Changes in 0.3-x releases of scatterplot3d:
0.3-36: import from base packages
0.3-37: allow for solid (colored) 3d planes
0.3-38: Fix Omegahat URL in the vignette, allow to visualize lm objects without intercept by s3d$plane3d()
+ 0.3-39: New asp argument (thanks for suggestions to Jari Oksanen)
+ reset mar setting on.exit()
+ bugfix for angle=90, angle=180
+ 0.3-40: revert: reset mar setting on.exit() from 0.3-39 as this introduced some bugs
known UNfixed bug:
xlim, ylim, zlim don't work *exactly* for enlarged areas
diff --git a/DESCRIPTION b/DESCRIPTION
index f90846f..0a32e47 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: scatterplot3d
-Version: 0.3-38
-Date: 2017-01-05
+Version: 0.3-40
+Date: 2017-04-22
Title: 3D Scatter Plot
Author: Uwe Ligges <ligges at statistik.tu-dortmund.de>, Martin Maechler, Sarah Schnackenberg
Maintainer: Uwe Ligges <ligges at statistik.tu-dortmund.de>
@@ -10,6 +10,6 @@ License: GPL-2
Encoding: latin1
Imports: grDevices, graphics, stats
NeedsCompilation: no
-Packaged: 2017-01-05 16:11:38 UTC; ligges
+Packaged: 2017-04-22 15:51:29 UTC; ligges
Repository: CRAN
-Date/Publication: 2017-01-05 19:03:19
+Date/Publication: 2017-04-22 16:17:10 UTC
diff --git a/MD5 b/MD5
index bb2cefc..b5bc29d 100644
--- a/MD5
+++ b/MD5
@@ -1,14 +1,14 @@
-d7fdc39a0a554b46f2c80b989b129f9a *CHANGES
-6f91d99e13747c6126fc0073362b4d62 *DESCRIPTION
-f0be121a6dd3fba1bab32eded326a5eb *NAMESPACE
-d3e1a06e349bc00a102c14c82ed20e09 *R/scatterplot3d.R
-96c296102f1d75798741c744ed272921 *build/vignette.rds
+2f540a3472c09cad708b4b5ce3011551 *CHANGES
+148e10705ae33778994d29f6d083227b *DESCRIPTION
+25ef0b29c86447064f211d249f875093 *NAMESPACE
+daa69077e258bd9f76f7595271448162 *R/scatterplot3d.R
+415a4f3e93aff26da396031ef947f996 *build/vignette.rds
75f154fc6802f86cefa004239b048243 *inst/CITATION
4227d2d500d52cdd18b7af5407621be0 *inst/doc/s3d.Rnw
-50f5a5659e6af097d50b796239c1d419 *inst/doc/s3d.pdf
+048fcfc5dc921400128645d61b464029 *inst/doc/s3d.pdf
50051f0feb902cf69820d01c45373e07 *inst/po/de/LC_MESSAGES/R-scatterplot3d.mo
3dd8ff033a10120127977c076dd14724 *inst/po/en/LC_MESSAGES/R-scatterplot3d.mo
-cc2b2a15cd28221fb2239af3f04ddebd *man/scatterplot3d.Rd
+1bfb8de4c04e947e5861919a73ffe6ee *man/scatterplot3d.Rd
49d9f35530b6522fd2ebba10ecbc5acc *po/R-de.po
a5bb89e45f7c077da641d8a06be0cf23 *po/R-en.po
60dc41149dec36e2c11909c3ade903b4 *po/R-scatterplot3d.pot
diff --git a/NAMESPACE b/NAMESPACE
index 462713c..09665e3 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,4 +1,4 @@
importFrom("grDevices", "rgb", "xyz.coords")
-importFrom("graphics", "lines", "mtext", "par", "plot.new", "plot.window", "points", "polygon", "segments", "strwidth", "text", "title")
+importFrom("graphics", "lines", "mtext", "par", "plot.new", "plot.window", "points", "polygon", "segments", "strwidth", "text", "title", "strheight")
importFrom("stats", "coef")
export(scatterplot3d)
diff --git a/R/scatterplot3d.R b/R/scatterplot3d.R
index 95255a4..db0775c 100644
--- a/R/scatterplot3d.R
+++ b/R/scatterplot3d.R
@@ -1,5 +1,5 @@
-scatterplot3d <-
-function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
+scatterplot3d <-
+function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
main = NULL, sub = NULL, xlim = NULL, ylim = NULL, zlim = NULL,
xlab = NULL, ylab = NULL, zlab = NULL, scale.y = 1, angle = 40,
axis = TRUE, tick.marks = TRUE, label.tick.marks = TRUE,
@@ -10,8 +10,8 @@ function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
col.grid = "grey", col.lab = par("col.lab"), cex.symbols = par("cex"),
cex.axis = 0.8 * par("cex.axis"), cex.lab = par("cex.lab"),
font.axis = par("font.axis"), font.lab = par("font.lab"),
- lty.axis = par("lty"), lty.grid = par("lty"), lty.hide=NULL,
- lty.hplot = par("lty"), log = "", ...)
+ lty.axis = par("lty"), lty.grid = par("lty"), lty.hide=NULL,
+ lty.hplot = par("lty"), log = "", asp = NA, ...)
# log not yet implemented
{
## Uwe Ligges <ligges at statistik.tu-dortmund.de>,
@@ -21,6 +21,7 @@ function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
## Parts of the help files are stolen from the standard plotting functions in R.
mem.par <- par(mar = mar)
+# on.exit(par(mem.par))
x.scal <- y.scal <- z.scal <- 1
xlabel <- if (!missing(x)) deparse(substitute(x))
ylabel <- if (!missing(y)) deparse(substitute(y))
@@ -67,8 +68,8 @@ function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
temp <- xlab; xlab <- ylab; ylab <- temp
temp <- xlim; xlim <- ylim; ylim <- temp
}
- angle.1 <- (1 < angle && angle < 2) || angle > 3
- angle.2 <- 1 <= angle && angle <= 3
+ angle.1 <- (1 < angle && angle <= 2) || angle > 3
+ angle.2 <- 1 < angle && angle <= 3
dat <- data.frame(xyz[c("x","y","z")], col = color, pch = pch, bg = bg, stringsAsFactors = FALSE)
## xlim, ylim, zlim -- select the points inside the limits
if(!is.null(xlim)) {
@@ -144,14 +145,29 @@ function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
z.range <- range(z.min, z.max)
### init graphics
+
+### convert asp for plot (based on suggestions from Jari Oksanen)
+ if(!is.na(asp)) {
+ x.i <- x.min:x.max
+ z.i <- z.min:z.max
+ range.x <- abs(diff(range(x.i * x.scal)))
+ range.z <- abs(diff(range(z.i * z.scal)))
+ asp <- asp * (range.z / (length(z.i) - 1)) / (range.x / (length(x.i) - 1))
+ }
plot.new()
if(angle.2) {x1 <- x.min + yx.f * y.max; x2 <- x.max}
else {x1 <- x.min; x2 <- x.max + yx.f * y.max}
- plot.window(c(x1, x2), c(z.min, z.max + yz.f * y.max))
+ plot.window(c(x1, x2), c(z.min, z.max + yz.f * y.max), asp = asp)
temp <- strwidth(format(rev(y.prty))[1], cex = cex.axis/par("cex"))
+
+### lheight in usr units for numeric aspect is needed to locate
+### side 2 and 4 axis annotation with fixes aspect.
+ lheight <- (strheight("\n") - strheight("M")) * asp
+ lheight2 <- (strheight("\n") - strheight("M"))
+
if(angle.2) x1 <- x1 - temp - y.margin.add
else x2 <- x2 + temp + y.margin.add
- plot.window(c(x1, x2), c(z.min, z.max + yz.f * y.max))
+ plot.window(c(x1, x2), c(z.min, z.max + yz.f * y.max), asp = asp)
if(angle > 2) par("usr" = par("usr")[c(2, 1, 3:4)])
usr <- par("usr") # we have to remind it for use in closures
title(main, sub, ...)
@@ -188,18 +204,40 @@ function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
if(label.tick.marks) { ## label tick marks
las <- par("las")
- mytext <- function(labels, side, at, ...)
- mtext(text = labels, side = side, at = at, line = -.5,
+ mytext <- function(labels, side, at, line = -0.5, ...)
+ mtext(text = labels, side = side, at = at, line = line,
col=col.lab, cex=cex.axis, font=font.lab, ...)
## X
if(is.null(x.ticklabs))
x.ticklabs <- format(i.x * x.scal)
- mytext(x.ticklabs, side = 1, at = i.x)
+ if(!is.na(asp)) {
+ linepad <- (usr[3] - z.min)/lheight2 + 0.5
+ mytext(x.ticklabs, side = 1, at = i.x, line = linepad)
+ } else {
+ mytext(x.ticklabs, side = 1, at = i.x)
+ }
## Z
if(is.null(z.ticklabs))
z.ticklabs <- format(i.z * z.scal)
+ if(!is.na(asp)) {
+ if(angle.1) {
+ if(angle > 2) {
+ linepad <- (x2 - usr[1])/lheight + 0.5
+ } else {
+ linepad <- (x2 - usr[2])/lheight + 0.5
+ }
+ } else {
+ if(angle > 2) {
+ linepad <- (usr[2] - x1)/lheight + 0.5
+ } else {
+ linepad <- (usr[1] - x1)/lheight + 0.5
+ }
+ }
+ } else {
+ linepad = -0.5
+ }
mytext(z.ticklabs, side = if(angle.1) 4 else 2, at = i.z,
- adj = if(0 < las && las < 3) 1 else NA)
+ adj = if(0 < las && las < 3) 1 else NA, line = linepad)
## Y
temp <- if(angle > 2) rev(i.y) else i.y ## turn y-labels around
if(is.null(y.ticklabs))
@@ -220,14 +258,18 @@ function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
cex = cex.lab, font = font.axis, las = 0)
## X
lines(c(x.min, x.max), c(z.min, z.min), col = col.axis, lty = lty.axis)
- mytext2(xlab, 1, line = 1.5, at = mean(x.range))
+ if(!is.na(asp)) {
+ mytext2(xlab, 1, line = (usr[3] - z.min)/lheight2 + 1.5, at = mean(x.range))
+ } else {
+ mytext2(xlab, 1, line = 1.5, at = mean(x.range))
+ }
## Y
lines(xx[1] + c(0, y.max * yx.f), c(z.min, y.max * yz.f + z.min),
col = col.axis, lty = lty.axis)
- mytext2(ylab, if(angle.1) 2 else 4, line= 0.5, at = z.min + y.max * yz.f)
+ mytext2(ylab, if(angle.1) 2 else 4, line = linepad + 1, at = z.min + y.max * yz.f)
## Z
lines(xx[c(2,2)], c(z.min, z.max), col = col.axis, lty = lty.axis)
- mytext2(zlab, if(angle.1) 4 else 2, line= 1.5, at = mean(z.range))
+ mytext2(zlab, if(angle.1) 4 else 2, line = linepad + 2, at = mean(z.range))
if(box) {
if(is.null(lty.hide)) lty.hide <- lty.axis
## X
@@ -278,7 +320,7 @@ function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
ob <- ls() ## remove all unused objects from the result's enviroment:
rm(list = ob[!ob %in% c("angle", "mar", "usr", "x.scal", "y.scal", "z.scal", "yx.f",
"yz.f", "y.add", "z.min", "z.max", "x.min", "x.max", "y.max",
- "x.prty", "y.prty", "z.prty")])
+ "x.prty", "y.prty", "z.prty", "mem.par")])
rm(ob)
invisible(list(
xyz.convert = function(x, y=NULL, z=NULL) {
@@ -299,7 +341,7 @@ function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
x <- xyz$x / x.scal + yx.f * y2
y <- xyz$z / z.scal + yz.f * y2
mem.par <- par(mar = mar, usr = usr)
- on.exit(par(mem.par))
+ #on.exit(par(mem.par))
if(type == "h") {
y2 <- z.min + yz.f * y2
segments(x, y, x, y2, ...)
@@ -323,7 +365,7 @@ function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
Intercept <- Intercept[1]
}
mem.par <- par(mar = mar, usr = usr)
- on.exit(par(mem.par))
+ #on.exit(par(mem.par))
x <- x.min:x.max
y <- 0:y.max
@@ -351,13 +393,14 @@ function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
},
box3d = function(...){
mem.par <- par(mar = mar, usr = usr)
- on.exit(par(mem.par))
+ #on.exit(par(mem.par))
lines(c(x.min, x.max), c(z.max, z.max), ...)
lines(c(0, y.max * yx.f) + x.max, c(0, y.max * yz.f) + z.max, ...)
lines(c(0, y.max * yx.f) + x.min, c(0, y.max * yz.f) + z.max, ...)
lines(c(x.max, x.max), c(z.min, z.max), ...)
lines(c(x.min, x.min), c(z.min, z.max), ...)
lines(c(x.min, x.max), c(z.min, z.min), ...)
- }
+ },
+ par.mar = mem.par
))
}
diff --git a/build/vignette.rds b/build/vignette.rds
index eb4cf3c..1b0f6a0 100644
Binary files a/build/vignette.rds and b/build/vignette.rds differ
diff --git a/inst/doc/s3d.pdf b/inst/doc/s3d.pdf
index 93ae0a5..0b15b10 100644
Binary files a/inst/doc/s3d.pdf and b/inst/doc/s3d.pdf differ
diff --git a/man/scatterplot3d.Rd b/man/scatterplot3d.Rd
index 7024a5c..b411e99 100644
--- a/man/scatterplot3d.Rd
+++ b/man/scatterplot3d.Rd
@@ -18,7 +18,7 @@ scatterplot3d(x, y=NULL, z=NULL, color=par("col"), pch=par("pch"),
cex.lab=par("cex.lab"), font.axis=par("font.axis"),
font.lab=par("font.lab"), lty.axis=par("lty"),
lty.grid=par("lty"), lty.hide=NULL, lty.hplot=par("lty"),
- log="", ...)
+ log="", asp=NA, ...)
}
\arguments{
\item{x}{the coordinates of points in the plot.}
@@ -54,7 +54,8 @@ scatterplot3d(x, y=NULL, z=NULL, color=par("col"), pch=par("pch"),
On some devices not all colors can be displayed. In this case try the
postscript device or use \code{highlight.3d = FALSE}.}
\item{mar}{A numerical vector of the form c(bottom, left, top, right)
- which gives the lines of margin to be specified on the four sides of the plot.}
+ which gives the lines of margin to be specified on the four sides of the plot.
+ See section Values on how to change the setting back to the default / previous setting.}
\item{bg}{background (fill) color for the open plot symbols given by pch = 21:25.}
\item{col.axis, col.grid, col.lab}{the color to be used for axis / grid / axis labels.}
\item{cex.symbols, cex.axis, cex.lab}{the magnification to be used for
@@ -65,6 +66,7 @@ scatterplot3d(x, y=NULL, z=NULL, color=par("col"), pch=par("pch"),
\item{lty.hplot}{the line type to be used for vertical segments with \code{type = "h"}.}
\item{log}{Not yet implemented! A character string which contains "x"
(if the x axis is to be logarithmic), "y", "z", "xy", "xz", "yz", "xyz".}
+ \item{asp}{numeric, giving the \bold{asp}ect ratio z/x or z/y, see \sQuote{Note}.}
\item{\dots}{more graphical parameters can be given as arguments,
\code{pch = 16} or \code{pch = 20} may be nice.}
}
@@ -85,6 +87,8 @@ scatterplot3d(x, y=NULL, z=NULL, color=par("col"), pch=par("pch"),
The list in \code{polygon_args} collects arguments to be passed to the underlying
\code{\link[graphics]{polygon}} call that draws a solid (or transparent) plane if \code{draw_polygon=TRUE}.}
\item{box3d}{function which \dQuote{refreshes} the box surrounding the plot.}
+ \item{par.mar}{As the function modifies the \code{par("mar")} settings of the current device and needs to keep these in case you add elements to the plot later on,
+ you can change these back via \code{par(object$par.mar)} in case you want to add more plots with default margins to the current device.}
}
\references{
Ligges, U., and Maechler, M. (2003):
@@ -107,10 +111,16 @@ scatterplot3d(x, y=NULL, z=NULL, color=par("col"), pch=par("pch"),
for axis calculation. So we recommend to try the specification of
graphical parameters at first as arguments in \code{scatterplot3d} and
only if needed as arguments in previous \code{par()} call.
+
+ If \code{asp} is a finite positive value then the window is set up so that one
+ data unit in the x or y direction (the one that ist plotted horizontally
+ - depends on \code{angle} -) is equal in length to \code{asp} \eqn{\times}{*}
+ one data unit in the z direction.
+ The variation of \code{asp} is only reasonable if the default values
+ \code{x.ticklabs=NULL}, \code{y.ticklabs=NULL}, \code{z.ticklabs=NULL} are not changed.
}
\author{
- Uwe Ligges \email{ligges at statistik.tu-dortmund.de};
- \url{http://www.statistik.tu-dortmund.de/~ligges}.
+ Uwe Ligges \email{ligges at statistik.tu-dortmund.de}, Martin Maechler, Sarah Schnackenberg
}
\seealso{
\code{\link[graphics]{persp}}, \code{\link[graphics]{plot}}, \code{\link[graphics]{par}}.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/scatterplot3d.git
More information about the debian-science-commits
mailing list