
Plot a Japan Map
plot_jpmap.RdPlots Japan prefecture or municipal boundaries using ggplot2.
Usage
plot_jpmap(
regions = c("prefectures", "prefecture", "municipalities", "municipality"),
include = c(),
exclude = c(),
data = data.frame(),
values = NULL,
labels = FALSE,
label_color = "black",
data_year = NULL,
inset = TRUE,
okinawa = TRUE,
ogasawara = TRUE,
territorial_disputes = TRUE,
disputed_fill = NULL,
disputed_color = NULL,
disputed_linewidth = NULL,
disputed_dots = FALSE,
disputed_dot_fill = "#001040",
disputed_dot_color = "white",
disputed_dot_size = 1.25,
disputed_dot_stroke = 0.2,
inset_boxes = TRUE,
inset_box_color = "grey50",
inset_box_linewidth = 0.35,
data_dir = NULL,
xlim = NULL,
ylim = NULL,
x_breaks = ggplot2::waiver(),
y_breaks = ggplot2::waiver(),
x_labels = ggplot2::waiver(),
y_labels = ggplot2::waiver(),
fill = "grey92",
color = "grey35",
linewidth = 0.25,
...
)Arguments
- regions
Boundary level: prefectures or municipalities.
- include
Regions to include by code, English name, or Japanese name.
- exclude
Regions to exclude by code, English name, or Japanese name.
- data
Optional data frame to join to the map.
- values
Column name in
datato use as the fill variable.- labels
Whether to draw region labels.
- label_color
Label text color.
- data_year
Boundary data year.
- inset
Inset behavior. Use
TRUEto move both Okinawa and Ogasawara,FALSEfor no movement, or a character vector containing"okinawa"and/or"ogasawara"to move selected island groups. For filtered municipality maps such asplot_jpmap("municipality", include = "Okinawa"), the default plot frame is local and non-inset unlessinsetis supplied explicitly.- okinawa
Whether Okinawa should be moved when
insetincludes it.- ogasawara
Whether Ogasawara should be moved when
insetincludes it.- territorial_disputes
Whether to include disputed-territory island/reef shapes. Use
FALSEto exclude them, or a character vector containing one or more of"northern_territories","okinotorishima","senkaku", and"takeshima".- disputed_fill
Optional fill color for disputed-territory shapes. When
NULL, the ordinary map fill is used.- disputed_color
Optional outline color for disputed-territory shapes. When
NULL, the ordinary map outline is used.- disputed_linewidth
Optional line width for disputed-territory shapes.
- disputed_dots
Whether to draw dot markers on disputed-territory shapes.
- disputed_dot_fill
Fill color for disputed-territory dot markers.
- disputed_dot_color
Outline color for disputed-territory dot markers.
- disputed_dot_size
Size for disputed-territory dot markers.
- disputed_dot_stroke
Stroke width for disputed-territory dot markers.
- inset_boxes
Whether to draw boxes around transported Okinawa and Ogasawara insets.
- inset_box_color
Outline color for inset boxes.
- inset_box_linewidth
Line width for inset boxes.
- data_dir
Optional directory containing
jpmap_boundaries_YYYY.gpkg.- xlim, ylim
Optional longitude and latitude limits for the plot frame.
- x_breaks, y_breaks
Optional longitude and latitude axis breaks.
- x_labels, y_labels
Optional longitude and latitude axis labels.
- fill
Boundary fill color when
valuesis not supplied.- color
Boundary line color.
- linewidth
Boundary line width.
- ...
Additional arguments passed to
ggplot2::geom_sf().
Examples
if (nrow(available_jpmap_data()) > 0) {
plot_jpmap("prefecture")
plot_jpmap("prefecture", ogasawara = FALSE)
plot_jpmap("prefecture", territorial_disputes = FALSE)
plot_jpmap(
"prefecture",
ogasawara = FALSE,
xlim = c(122, 149),
ylim = c(28.5, 47),
x_breaks = seq(125, 145, 5),
y_breaks = seq(30, 45, 5)
)
plot_jpmap("prefecture", inset_boxes = FALSE)
plot_jpmap("municipality", include = "Okinawa")
}