Skip to content

Commit

Permalink
version 0.3-37
Browse files Browse the repository at this point in the history
  • Loading branch information
uligges authored and cran-robot committed May 24, 2016
1 parent c9ac1f4 commit 841e219
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -66,6 +66,7 @@ Changes in 0.3-x releases of scatterplot3d:
0.3-35: arguments pch and bg caused failures when axes got restricted.
(reported by Hans-Joachim Pitz)
0.3-36: import from base packages
0.3-37: allow for solid (colored) 3d planes

known UNfixed bug:
xlim, ylim, zlim don't work *exactly* for enlarged areas
8 changes: 4 additions & 4 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: scatterplot3d
Version: 0.3-36
Date: 2015-07-30
Version: 0.3-37
Date: 2016-05-24
Title: 3D Scatter Plot
Author: Uwe Ligges <ligges@statistik.tu-dortmund.de>, Martin Maechler, Sarah Schnackenberg
Maintainer: Uwe Ligges <ligges@statistik.tu-dortmund.de>
Expand All @@ -9,7 +9,7 @@ Depends: R (>= 2.7.0)
License: GPL-2
Encoding: latin1
Imports: grDevices, graphics, stats
Packaged: 2015-07-29 22:30:44 UTC; ligges
NeedsCompilation: no
Packaged: 2016-05-24 11:03:33 UTC; ligges
Repository: CRAN
Date/Publication: 2015-07-30 00:32:00
Date/Publication: 2016-05-24 13:06:14
14 changes: 7 additions & 7 deletions MD5
@@ -1,14 +1,14 @@
fbd5e19f9d830888b203d206eea79941 *CHANGES
cfcdad8f3da80b4058740e276ea64bc8 *DESCRIPTION
3f23d861171f47729de45b704fb0cb49 *NAMESPACE
b00afe1c44acc6ca0c23cd88591dfee9 *R/scatterplot3d.R
d951632c4dee0e0e0ff26ad03e8964fa *build/vignette.rds
45e9b034511467fe1cae2489f5f3993c *CHANGES
4aa11c316317499ce4bd39874cd44d32 *DESCRIPTION
f0be121a6dd3fba1bab32eded326a5eb *NAMESPACE
1151f5d5be7ecebe65866992cb996d2d *R/scatterplot3d.R
96c296102f1d75798741c744ed272921 *build/vignette.rds
75f154fc6802f86cefa004239b048243 *inst/CITATION
4227d2d500d52cdd18b7af5407621be0 *inst/doc/s3d.Rnw
f0ca3eae0588111c9cd3e655b68a3712 *inst/doc/s3d.pdf
223d7de2f122254345b81777cc05818d *inst/doc/s3d.pdf
50051f0feb902cf69820d01c45373e07 *inst/po/de/LC_MESSAGES/R-scatterplot3d.mo
3dd8ff033a10120127977c076dd14724 *inst/po/en/LC_MESSAGES/R-scatterplot3d.mo
0e981a49cfc54485f6424ddffd131c25 *man/scatterplot3d.Rd
cc2b2a15cd28221fb2239af3f04ddebd *man/scatterplot3d.Rd
49d9f35530b6522fd2ebba10ecbc5acc *po/R-de.po
a5bb89e45f7c077da641d8a06be0cf23 *po/R-en.po
60dc41149dec36e2c11909c3ade903b4 *po/R-scatterplot3d.pot
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
@@ -1,4 +1,4 @@
importFrom("grDevices", "rgb", "xyz.coords")
importFrom("graphics", "lines", "mtext", "par", "plot.new", "plot.window", "points", "segments", "strwidth", "text", "title")
importFrom("graphics", "lines", "mtext", "par", "plot.new", "plot.window", "points", "polygon", "segments", "strwidth", "text", "title")
importFrom("stats", "coef")
export(scatterplot3d)
22 changes: 17 additions & 5 deletions R/scatterplot3d.R
Expand Up @@ -308,7 +308,9 @@ function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
else points(x, y, type = type, ...)
},
plane3d = function(Intercept, x.coef = NULL, y.coef = NULL,
lty = "dashed", lty.box = NULL, ...){
lty = "dashed", lty.box = NULL, draw_lines = TRUE, draw_polygon = FALSE,
polygon_args = list(border = NA, col = rgb(0,0,0,0.2)),
...){
if(!is.atomic(Intercept) && !is.null(coef(Intercept))) Intercept <- coef(Intercept)
if(is.null(lty.box)) lty.box <- lty
if(is.null(x.coef) && length(Intercept) == 3){
Expand All @@ -319,19 +321,29 @@ function(x, y = NULL, z = NULL, color = par("col"), pch = par("pch"),
mem.par <- par(mar = mar, usr = usr)
on.exit(par(mem.par))
x <- x.min:x.max
y <- 0:y.max

ltya <- c(lty.box, rep(lty, length(x)-2), lty.box)
x.coef <- x.coef * x.scal
z1 <- (Intercept + x * x.coef + y.add * y.coef) / z.scal
z2 <- (Intercept + x * x.coef +
(y.max * y.scal + y.add) * y.coef) / z.scal
segments(x, z1, x + y.max * yx.f, z2 + yz.f * y.max, lty = ltya, ...)
y <- 0:y.max

if(draw_polygon)
do.call("polygon", c(list(
c(x.min, x.min + y.max * yx.f, x.max + y.max * yx.f, x.max),
c(z1[1], z2[1] + yz.f * y.max, z2[length(z2)] + yz.f * y.max, z1[length(z1)])),
polygon_args))
if(draw_lines)
segments(x, z1, x + y.max * yx.f, z2 + yz.f * y.max, lty = ltya, ...)

ltya <- c(lty.box, rep(lty, length(y)-2), lty.box)
y.coef <- (y * y.scal + y.add) * y.coef
z1 <- (Intercept + x.min * x.coef + y.coef) / z.scal
z2 <- (Intercept + x.max * x.coef + y.coef) / z.scal
segments(x.min + y * yx.f, z1 + y * yz.f,
x.max + y * yx.f, z2 + y * yz.f, lty = ltya, ...)
if(draw_lines)
segments(x.min + y * yx.f, z1 + y * yz.f,
x.max + y * yx.f, z2 + y * yz.f, lty = ltya, ...)
},
box3d = function(...){
mem.par <- par(mar = mar, usr = usr)
Expand Down
Binary file modified build/vignette.rds
Binary file not shown.
Binary file modified inst/doc/s3d.pdf
Binary file not shown.
8 changes: 6 additions & 2 deletions man/scatterplot3d.Rd
Expand Up @@ -75,11 +75,15 @@ scatterplot3d(x, y=NULL, z=NULL, color=par("col"), pch=par("pch"),
\item{points3d}{function which draws points or lines into the existing plot.}
\item{plane3d}{function which draws a plane into the existing plot:
\code{plane3d(Intercept, x.coef = NULL, y.coef = NULL, lty =
"dashed", lty.box = NULL, ...)}.
"dashed", lty.box = NULL, draw_lines = TRUE, draw_polygon = FALSE,
polygon_args = list(border = NA, col = rgb(0,0,0,0.2)), ...)}.
Instead of \code{Intercept} a vector containing 3
elements or an (g)lm object can be specified.
The argument \code{lty.box} allows to set a different line style for the
intersecting lines in the box's walls.}
intersecting lines in the box's walls. The arguments \code{draw_lines} and \code{draw_polygon}
allow for choosing whether to represent the plane via line segments or as a solid surface, respectively.
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.}
}
\references{
Expand Down

0 comments on commit 841e219

Please sign in to comment.