From 79ff39758e42ad8594ebe867ec02fec2ada88d57 Mon Sep 17 00:00:00 2001 From: rhijmans Date: Wed, 22 May 2024 02:46:25 -0700 Subject: [PATCH] m --- NEWS.md | 1 + R/plot_legend.R | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 673494f13..2c2060936 100644 --- a/NEWS.md +++ b/NEWS.md @@ -24,6 +24,7 @@ - `inset` has new arguments "offset" and "add" [#1422](https://github.com/rspatial/terra/issues/1422) by Armand-CT - `expanse` has argument `usenames` [#1446](https://github.com/rspatial/terra/issues/1446) by Bappa Das - the default color palette is now `terra::map.pal("viridis")` instead of `terrain.colors`. The default can be changes with `options(terra.pal=...)` [#1474](https://github.com/rspatial/terra/issues/1474) by Derek Friend +- `as.list` now returns a named list. [#1513](https://github.com/rspatial/terra/issues/1513) by Eric R. Scott ## new diff --git a/R/plot_legend.R b/R/plot_legend.R index 9a22cac1f..8c18d8e17 100644 --- a/R/plot_legend.R +++ b/R/plot_legend.R @@ -508,13 +508,13 @@ add_box <- function(...) { add_grid <- function(nx=NULL, ny=nx, col="lightgray", lty="dotted", lwd=par("lwd")) { - p <- terra:::get.clip() + p <- terra::get.clip() ## adapted from graphics::grid g.grid.at <- function (side, n, axp, usr2) { if (is.null(n)) { stopifnot(is.numeric(ax <- axp), length(ax) == 3L) - axTicks(side, axp=ax, usr=usr2, log=FALSE) + graphics::axTicks(side, axp=ax, usr=usr2, log=FALSE) } else if (!is.na(n) && (n <- as.integer(n)) >= 1L) { at <- seq.int(usr2[1L], usr2[2L], length.out = n + 1L) @@ -523,10 +523,10 @@ add_grid <- function(nx=NULL, ny=nx, col="lightgray", lty="dotted", lwd=par("lwd } atx <- if (is.null(nx) || (!is.na(nx) && nx >= 1)) - g.grid.at(1L, nx, axp = par("xaxp"), usr2 = p[1:2]) + g.grid.at(1L, nx, axp = graphics::par("xaxp"), usr2 = p[1:2]) aty <- if (is.null(ny) || (!is.na(ny) && ny >= 1)) - g.grid.at(2L, ny, axp = par("yaxp"), usr2 = p[3:4]) - abline(v = atx, h = aty, col = col, lty = lty, lwd = lwd) + g.grid.at(2L, ny, axp = graphics::par("yaxp"), usr2 = p[3:4]) + graphics::abline(v = atx, h = aty, col = col, lty = lty, lwd = lwd) invisible(list(atx = atx, aty = aty)) }