knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  warning = FALSE, 
  message = FALSE
)
library(jpmesh)
library(sf)
df_polys <- 
  meshcode_set(mesh_size = 80) %>% 
  jpmesh::export_meshes()

base

df_polys %>% 
  st_geometry() %>% 
  plot()

ggplot2

library(ggplot2)
ggplot() +
  geom_sf(data = df_polys, fill = NA) +
  geom_text(
    data = cbind(
      mesh = df_polys$meshcode,
      df_polys$geometry %>%
        st_centroid() %>%
        st_coordinates() %>%
        as.data.frame()
    ),
    aes(X, Y, label = mesh),
    size = 1.2
  ) +
  coord_sf(datum = NA) +
  theme_void()

leaflet

library(leaflet)
leaflet() %>% 
  addTiles() %>% 
  addPolygons(data = df_polys)

plotly

wip...

sessionInfo()


uribo/jpmesh documentation built on Feb. 21, 2023, 3:20 p.m.