mirror of
https://github.com/sensebox/opensensmapr
synced 2025-02-20 11:53:57 +01:00
reset par on exit
This commit is contained in:
parent
95f4f889da
commit
334a49a309
2 changed files with 4 additions and 4 deletions
|
@ -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…
Add table
Reference in a new issue