---
title: "Layout"
output: rmarkdown::html_vignette
author: "Chi Zhang"
date: "2021-01-15"
vignette: >
%\VignetteIndexEntry{Layout}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{knitr::rmarkdown}
editor_options:
chunk_output_type: console
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(csmaps)
library(ggplot2)
library(data.table)
library(magrittr)
```
## Layout options
We have 3 layout options for Norway map: **default, split** and **insert Oslo**.
For Oslo county map, we only have the **default** layout.
### Norway layout: default
```{r fig.height=6, fig.width=6}
pd <- copy(csmaps::nor_municip_map_b2024_default_dt)
q <- ggplot()
q <- q + geom_polygon(data = pd, aes( x = long, y = lat, group = group),
color="black", fill="white", linewidth = 0.2)
q <- q + theme_void()
q <- q + coord_quickmap()
q <- q + labs(title = "Default layout")
q
```
### Norway layout: split
```{r fig.height=6, fig.width=6}
pd <- copy(csmaps::nor_municip_map_b2024_split_dt)
q <- ggplot()
q <- q + geom_polygon(data = pd, aes( x = long, y = lat, group = group),
color="black", fill="white", linewidth = 0.2)
q <- q + theme_void()
q <- q + coord_quickmap()
q <- q + labs(title = "Split layout")
q
```
### Norway layout: insert oslo
```{r fig.height=6, fig.width=6}
pd <- copy(csmaps::nor_municip_map_b2024_insert_oslo_dt)
q <- ggplot()
q <- q + geom_polygon(data = pd, aes( x = long, y = lat, group = group),
color="black", fill="white", linewidth = 0.2)
# add title "Oslo"
q <- q + annotate(
"text",
x = csmaps::nor_xxx_position_title_insert_oslo_b2024_insert_oslo_dt$long,
y = csmaps::nor_xxx_position_title_insert_oslo_b2024_insert_oslo_dt$lat,
label = "Oslo"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q <- q + labs(title = "Insert Oslo layout")
q
```
#### Oslo ward layout: default
```{r fig.height=6, fig.width=6}
pd <- copy(csmaps::oslo_ward_map_b2024_default_dt)
q <- ggplot()
q <- q + geom_polygon(data = pd, aes(x = long, y = lat, group = group),
color="black", fill="white", linewidth = 0.2)
q <- q + theme_void()
q <- q + coord_quickmap()
q <- q + labs(title = "Oslo wards")
q
```