## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", message = FALSE, fig.width = 7, fig.height = 5, dpi = 120, fig.bg = "white", dev.args = list(bg = "white") ) jpmap_build_full_vignettes <- identical(tolower(Sys.getenv("JPMAP_FULL_VIGNETTES")), "true") || identical(tolower(Sys.getenv("IN_PKGDOWN")), "true") jpmap_has_boundary_data <- jpmap_build_full_vignettes && nrow(jpmap::available_jpmap_data()) > 0 ## ----------------------------------------------------------------------------- library(tidyverse) library(jpmap) gdp <- jp_prefecture_gdp |> select(pref_code, prefecture, gdp_per_capita_jpy) ## ----prefectural-gdp, eval = jpmap_has_boundary_data-------------------------- # plot_jpmap( # "prefecture", # data = gdp, # values = "gdp_per_capita_jpy", # color = "grey35", # linewidth = 0.25 # ) + # scale_fill_gradient( # low = "#D9E8FF", # high = "#001040", # name = "GDP per capita\n(JPY)" # ) + # labs( # title = "Prefecture GDP per capita", # caption = "GDP data: OECD 2021 values tabulated on Wikipedia." # ) + # theme( # legend.background = element_rect(fill = "white", color = NA), # plot.title = element_text(face = "bold", color = "#001040"), # plot.caption = element_text(color = "#2C2A29", hjust = 0, size = 8) # )