reset par on exit

master
jan 1 year ago
parent 95f4f889da
commit 334a49a309

@ -20,12 +20,12 @@ plot.sensebox = function (x, ..., mar = c(2, 2, 1, 1)) {
sf::st_as_sf() %>%
sf::st_geometry()
oldpar = par()
oldpar <- par(no.readonly = TRUE)
on.exit(par(oldpar))
par(mar = mar)
plot(world, col = 'gray', xlim = bbox[c(1, 3)], ylim = bbox[c(2, 4)], axes = TRUE, ...)
plot(geom, add = TRUE, col = x$exposure, ...)
legend('left', legend = levels(x$exposure), col = 1:length(x$exposure), pch = 1)
par(mar = oldpar$mar)
invisible(x)
}

@ -1,9 +1,9 @@
#' @export
plot.osem_measurements = function (x, ..., mar = c(2, 4, 1, 1)) {
oldpar = par()
oldpar <- par(no.readonly = TRUE)
on.exit(par(oldpar))
par(mar = mar)
plot(value~createdAt, x, col = factor(x$sensorId), xlab = NA, ylab = x$unit[1], ...)
par(mar = oldpar$mar)
invisible(x)
}

Loading…
Cancel
Save