diff --git a/code/de_9im.R b/code/de_9im.R index a12b990..c3ea1b2 100644 --- a/code/de_9im.R +++ b/code/de_9im.R @@ -48,15 +48,15 @@ de_9im = function(x, funs_matched[[i]](x, y, sparse = sparse) }) res = unlist(res) - if(output == "character") { + if (output == "character") { res = unlist(funs)[res] } res_text2 = "" - if(include_relate) { + if (include_relate) { relation = sf::st_relate(x, y) res_text2 = paste0(" \nDE-9IM string: \n", relation) } - if(plot) { + if (plot) { res_text1 = paste(res, collapse = collapse) collapse_no_break = gsub(pattern = "\\n", replacement = "", x = collapse) res_text1 = paste0(res_text1, collapse_no_break) @@ -88,14 +88,17 @@ de_9im_plot2 = function(xy, label1 = "test", label2 = "", theme = ggplot2::theme_void()) { require("tmap", quietly = TRUE) # browser() + # toDo: does not work yet + st_crs(xy) = "EPSG:2180" tm_shape(xy) + - tm_polygons("Object", legend.show = FALSE, alpha = alpha, - palette = c("#E36939", "#6673E3")) + - tm_credits(label1, position = c(0.1, "top"), just = "top") + - tm_credits(label2, position = c(0.1, 0.4), fontface = "italic", just = "bottom") + + tm_polygons("Object", fill.legend = tm_legend_hide(), + fill_alpha = alpha, + fill.scale = tm_scale(values = c("#E36939", "#6673E3"))) + + tm_credits(label1, position = c(0.07, 0.62), just = "top") + + tm_credits(label2, position = c(0.07, 0.32), fontface = "italic", just = "bottom") + tm_layout(frame = FALSE) } - +9 # # Test code to functionalize: # theme_set(new = theme_void()) # g1 = ggplot(ps1) + geom_sf(aes(fill = Object), alpha = 0.5, show.legend = FALSE)