[Dplr-commits] r880 - pkg/dplR/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat May 17 01:07:11 CEST 2014
Author: mvkorpel
Date: 2014-05-17 01:07:10 +0200 (Sat, 17 May 2014)
New Revision: 880
Modified:
pkg/dplR/R/rasterPlot.R
pkg/dplR/R/wavelet.plot.R
Log:
wavelet.plot() is now using interpolate=FALSE in rasterImage(),
through dplR::rasterPlot()". The difference between 'antialias' and
'interpolate' is that the former option works at the time when the
raster image (png) is created and the latter has an effect on how the
raster image is shown. This change has a small impact on the
appearance of pictures from wavelet.plot(useRaster=TRUE).
Modified: pkg/dplR/R/rasterPlot.R
===================================================================
--- pkg/dplR/R/rasterPlot.R 2014-05-16 11:25:32 UTC (rev 879)
+++ pkg/dplR/R/rasterPlot.R 2014-05-16 23:07:10 UTC (rev 880)
@@ -6,17 +6,24 @@
###
### Arguments:
### x Low-level plotting commands representing elements to be added
-### to the current plot. Examples: lines(), points(), text(),
+### to the current plot. Examples: lines(), points(), text(),
### mtext(), .filled.contour()
### res Resolution in points per inch.
### Estimated useful range: 100 - 300.
### region Draw in the plot region or the figure region?
### The figure region contains the plot region and margins.
### Plotting in the outer margin is not supported.
-### antialias antialiasing argument for png(). "none" is preferred for
-### images. The default value (missing argument) is probably
-### good for line plots.
-rasterPlot <- function(x, res = 150, region=c("plot", "figure"), antialias) {
+### antialias Antialiasing option for png(). See argument 'antialias'
+### in ?png. "none" is preferred for images in which color
+### signifies value of data. The default (missing argument)
+### is probably good for line plots.
+### interpolate
+### Argument passed to rasterImage(). A logical flag.
+### The default is TRUE: use linear interpolation.
+### Analogously to 'antialias', FALSE is preferred when
+### color maps to value.
+rasterPlot <- function(x, res = 150, region=c("plot", "figure"), antialias,
+ interpolate = TRUE) {
if (identical(dev.capabilities("rasterImage")[["rasterImage"]], "no")) {
stop("device does not support raster images")
}
@@ -87,7 +94,8 @@
if (plotRegion) {
## Add a raster image to the plot region of the original plot
rasterImage(pngData, xleft = usrLeft, ybottom = usrBottom,
- xright = usrRight, ytop = usrTop)
+ xright = usrRight, ytop = usrTop,
+ interpolate = interpolate)
} else {
usrWidth <- usrRight - usrLeft
usrHeight <- usrTop - usrBottom
@@ -108,6 +116,7 @@
on.exit(par(xpd = op[["xpd"]]))
## Add a raster image to the figure region of the original plot
rasterImage(pngData, xleft = figLeft, ybottom = figBottom,
- xright = figRight, ytop = figTop)
+ xright = figRight, ytop = figTop,
+ interpolate = interpolate)
}
}
Modified: pkg/dplR/R/wavelet.plot.R
===================================================================
--- pkg/dplR/R/wavelet.plot.R 2014-05-16 11:25:32 UTC (rev 879)
+++ pkg/dplR/R/wavelet.plot.R 2014-05-16 23:07:10 UTC (rev 880)
@@ -93,7 +93,8 @@
z,
as.double(wavelet.levels),
key.cols))
- tryCatch(rasterPlot(cl, res = res, antialias = "none"),
+ tryCatch(rasterPlot(cl, res = res,
+ antialias = "none", interpolate = FALSE),
error = function(e) {
message(as.character(e), appendLF = FALSE)
message("reverting to useRaster=FALSE")
@@ -179,7 +180,8 @@
z,
as.double(wavelet.levels),
key.cols))
- tryCatch(rasterPlot(cl, res = res, antialias = "none"),
+ tryCatch(rasterPlot(cl, res = res,
+ antialias = "none", interpolate = FALSE),
error = function(e) {
message(as.character(e), appendLF = FALSE)
message("reverting to useRaster=FALSE")
More information about the Dplr-commits
mailing list