mapsf icon indicating copy to clipboard operation
mapsf copied to clipboard

Perte de la fin du titre lors d'un dev.copy

Open mgageo opened this issue 1 year ago • 0 comments

Je sauvegarde en pdf ou en png la fenêtre graphique avec dev.copy. Alors qu'à l'écran le titre s'affiche complètement, le caractère de droite n'est pas visible sur les copies. à l'écran image en png, perte du "1" final image

Le script : https://github.com/mgageo/issues/blob/main/issue_mapsf4.R

library(sf)
library(mapsf)
library(tidyverse)
dsn <- "https://raw.githubusercontent.com/mgageo/issues/ee547796e3a99c966c2d0890f4807bf40f14f598/shape_stops_POSB-POSD-alsac-LYH.geojson"
nc1 <- st_read(dsn) %>%
  st_transform(2154) %>%
  glimpse()
shape.sf <- nc1 %>%
  filter(st_geometry_type(geometry) != "POINT") %>%
  glimpse()
points.sf <- st_sf(st_cast(st_geometry(shape.sf), "POINT"))

mf_init(shape.sf, expandBB = c(0.3, 0.3, 0.3, 0.3))
mf_map(x = shape.sf, col = "green", lwd = 3, add = TRUE)
mf_annotation(points.sf[1, ], txt = "Départ", col_txt = "blue", col_arrow = "blue")
mf_title("r1268247 : 0061-A-1510-3801", inner = TRUE)
w <- par("din")[1]
h <- par("din")[2]
dir <- tempdir()
dsn <- sprintf("%s/issue_mapsf4.pdf", dir)
print(sprintf("dsn: %s", dsn))
dev.copy(pdf, dsn, width = w, height = h)
dev.off()
dsn <- sprintf("%s/issue_mapsf4.png", dir)
print(sprintf("dsn: %s", dsn))
dev.copy(png, dsn)
dev.off()

mgageo avatar Aug 28 '24 11:08 mgageo