diff --git a/NEWS.md b/NEWS.md index f09c6dc0d..cc8117bd5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,15 +2,18 @@ ## bug fixes -- `readRDS` failed for rasters with timestep="seconds" +- `readRDS` failed for rasters with timestep="seconds" [#1711](https://github.com/rspatial/terra/issues/1711) by Pascal Oettli ## enhancements - `bestMatch` now has argument "fun" to allow the use of different distance measures, and a method +- `wrap` (and `writeRDS`) now capture varnames/longnames [#1719](https://github.com/rspatial/terra/issues/1719) by Andrew Gene Brown + ## new + # version 1.8-10 Released 2025-01-13 diff --git a/R/plot.R b/R/plot.R index 235a07a9d..0016ba720 100644 --- a/R/plot.R +++ b/R/plot.R @@ -191,7 +191,7 @@ halo <- function(x, y=NULL, labels, col="black", hc="white", hw=0.1, ... ) { setMethod("text", signature(x="SpatRaster"), - function(x, labels, digits=0, halo=FALSE, hc="white", hw=0.1, ...) { + function(x, labels, digits=0, halo=FALSE, hc="white", hw=0.1, cex=1, overlap=TRUE, ...) { if (missing(labels)) { labels <- 1 } @@ -215,10 +215,16 @@ setMethod("text", signature(x="SpatRaster"), } else if (is.numeric(labels)) { labels <- as.character(round(labels, digits=digits) ) } + if (length(labels) < nrow(xy)) { + labels <- rep(labels, nrow(xy)) + } +# if (!overlap) { +# xy <- getLabelXY(xy, labels, cex) +# } if (halo && (isTRUE(hw > 0))) { - .halo(xy[,1], xy[,2], labels, hc=hc, hw=hw, ...) + .halo(xy[,1], xy[,2], labels, hc=hc, hw=hw, cex=cex, ...) } else { - text(xy[,1], xy[,2], labels, ...) + text(xy[,1], xy[,2], labels, cex=cex, ...) } } ) diff --git a/man/adjacent.Rd b/man/adjacent.Rd index 254e4a9ab..8552925f1 100644 --- a/man/adjacent.Rd +++ b/man/adjacent.Rd @@ -33,7 +33,7 @@ When using global lon/lat rasters, adjacent cells at the other side of the date- } -\seealso{\code{\link{relate}}, \code{\link{nearby}}}, \code{\link{nearest}}} +\seealso{\code{\link{relate}, \link{nearby}, \link{nearest}}} \value{ matrix