Skip to content

Commit

Permalink
Change plot3D to open a new device only if needed
Browse files Browse the repository at this point in the history
http://stackoverflow.com/questions/32790652/displaying-multiple-3d-plots-in-the-same-window-using-plot3d-rastervis-in-r

plot3D opens a new device with each new call. This behaviour has been modified, and now a new device is opened only if none is active.
  • Loading branch information
oscarperpinan committed Sep 26, 2015
1 parent 98aec64 commit 09569e2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,8 +1,8 @@
Package: rasterVis
Type: Package
Title: Visualization Methods for Raster Data
Version: 0.37
Date: 2015-09-06
Version: 0.38
Date: 2015-09-26
Encoding: UTF-8
Authors@R: c(person("Oscar", "Perpinan Lamigueiro", email="oscar.perpinan@gmail.com", role=c('cre', 'aut')), person("Robert", "Hijmans", email= "r.hijmans@gmail.com", role='aut'))
Description: Methods for enhanced visualization and interaction with raster data. It implements visualization methods for quantitative data and categorical data, both for univariate and multivariate rasters. It also provides methods to display spatiotemporal rasters, and vector fields. See the website for examples.
Expand Down
3 changes: 2 additions & 1 deletion R/plot3d.R
Expand Up @@ -52,8 +52,9 @@ setMethod("plot3D", signature(x='RasterLayer'),
}
color <- level.colors(Zcol, at=at, col.regions=col)
}
## Open a device only if there is none active
if (rgl::rgl.cur() == 0) rgl::open3d()

rgl::open3d()
if (background==min(Zcol)) {
trans <- Zcol
trans[] <- 1.0
Expand Down
6 changes: 5 additions & 1 deletion man/plot3d.Rd
Expand Up @@ -52,7 +52,11 @@ Make an interactive 3D plot (map) of a RasterLayer. This is a wrapper around \co

}


\note{
Previous versions opened a new device with each call of
\code{plot3D}. This behaviour has been modified, and now a new device is
opened only if none is active. Thus, you should use \code{rgl::open3d()}
if you need to display a new scene without modifying the current one.}

\author{ Robert J. Hijmans and Oscar Perpiñán}

Expand Down

0 comments on commit 09569e2

Please sign in to comment.