## ----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)

bases_xy <- jp_us_military_bases |>
  filter(!is.na(personnel), personnel_is_base_specific) |>
  jpmap_transform(output_names = c("x", "y"))

## ----prefectural-base-points, eval = jpmap_has_boundary_data------------------
# plot_jpmap(
#   "prefecture",
#   fill = "grey92",
#   color = "grey35",
#   linewidth = 0.25
# ) +
#   geom_point(
#     data = bases_xy,
#     aes(x = x, y = y, size = personnel),
#     shape = 21,
#     fill = "#001040",
#     color = "grey15",
#     alpha = 0.85,
#     stroke = 0.35
#   ) +
#   scale_size_area(max_size = 8, name = "Personnel") +
#   labs(
#     title = "Selected U.S. military bases in Japan",
#     caption = "Base data: public source URLs listed in jp_us_military_bases$source_url."
#   ) +
#   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)
#   )

