diff --git a/R/step1_helper_facets.R b/R/step1_helper_facets.R index 6e5cc9f5..8fd5ebc3 100644 --- a/R/step1_helper_facets.R +++ b/R/step1_helper_facets.R @@ -46,6 +46,7 @@ get_split_stars_dim = function(lst) { # ## estimate number of facets step1_rearrange_facets = function(tmo, o) { #o = tmap_options_mode() + dev = getOption("tmap.devel.mode") # get the final tm_faets object (ignoring group specific args: is.wrap, by, rows, columns, pages) @@ -61,6 +62,9 @@ step1_rearrange_facets = function(tmo, o) { shp = tmg$tms$shp smeta = tmapGetShapeMeta1(shp, c(o, tmg$tmf)) + if (dev) timing_add(s3 = "get_shape_meta1") + + assign("vl", NULL, envir = .TMAP) assign("vn", 1L, envir = .TMAP) @@ -188,6 +192,8 @@ step1_rearrange_facets = function(tmo, o) { shp = tmapSplitShp(shp, split_stars_dim) if (split_stars_dim != "") { smeta = tmapGetShapeMeta1(shp, o) + if (dev) timing_add(s3 = "get_shape_meta1_2") + } @@ -294,8 +300,10 @@ step1_rearrange_facets = function(tmo, o) { smeta$vars = get("used_vars", envir = .TMAP) shp = tmapSubsetShp(shp, smeta$vars) - + if (dev) timing_add(s3 = "subset_shp") + smeta = tmapGetShapeMeta2(shp, smeta, c(o, tmg$tmf)) + if (dev) timing_add(s3 = "get_shape_meta2") diff --git a/sandbox/issues.R b/sandbox/issues.R index 3a20e7c1..e71745b2 100644 --- a/sandbox/issues.R +++ b/sandbox/issues.R @@ -445,4 +445,43 @@ tm_shape(nc.32119) + tm_polygons(c("SID74", "SID79"), fill.free = FALSE, fill.le tm_facets() -## \ No newline at end of file +## + +library(terra) +library(tmap) +lc = rast("https://osf.io/download/m92d7") + +system.time({plot(lc)}) + +summaryRprof() +Rprof(tmp <- tempfile()) +print(tm_shape(lc) + + tm_raster()) +Rprof() +summaryRprof(tmp) +unlink(tmp) + +World$well_being_rounded = round(World$well_being) +tm_shape(World) + tm_polygons("HPI") + tm_facets(by = "well_being_rounded") + +## maptiles leaflet inconsistancy (will be solved in maptiles) + +reprex::reprex({ + library(maptiles) + library(leaflet) + a = names(maptiles:::maptiles_providers) + b = names(leaflet::providers) + + a + b + setdiff(a, b) +}) + + +ttm() +tm_basemap(c("Esri.WorldShadedRelief", "Stadia.StamenTerrain")) + + tm_tiles("Stadia.StamenTerrainLines") + + tm_tiles("Stadia.StamenTerrainLabels") + + +