---
title: "Map Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
theme:
version: 3
bootswatch: flatly
source_code: embed
navbar:
- { icon: "fa-arrow-left", href: "https://k-maciejewski.github.io/YS_mapping/dashboard_101.html", align: right }
---
```{js}
$('.navbar-inverse').removeClass('navbar-inverse').addClass('navbar-default');
```
```{r setup, include=FALSE}
knitr::opts_chunk$set(eval = T, echo = F, message = F)
library(flexdashboard)
library(tidyverse)
library(plotly)
library(knitr)
library(maps)
library(usmap)
theme_set(theme_bw())
```
```{r data}
data(unemp)
unemp$colorBuckets <- as.numeric(cut(unemp$unemp, c(0, 2, 4, 6, 8, 10, 100)))
data(statepop)
```
# Unemployment Maps {data-orientation="rows"}
## Row 1
### US unemployment
```{r, all_US}
p <- plot_usmap(data = unemp,
values = "unemp",
size = .05,
theme = theme_minimal()) +
theme(axis.title = element_blank(),
axis.ticks = element_blank(),
axis.text = element_blank()) +
labs(fill = "Unemployment") +
viridis::scale_fill_viridis()
ggplotly(p)
```
### Unemployment for CA
```{r, CA_only}
p <- plot_usmap(include = "CA", # show only CA
data = unemp,
values = "unemp",
size = .05,
theme = theme_minimal()) +
theme(axis.title = element_blank(),
axis.ticks = element_blank(),
axis.text = element_blank()) +
labs(fill = "Unemployment") +
viridis::scale_fill_viridis()
ggplotly(p)
```
# Population Maps
## Row 2
### US Population 2015
```{r, population}
p <- plot_usmap(data = statepop,
values = "pop_2015") +
scale_fill_continuous(low = "white", high = "red",
name = "Population (2015)",
label = scales::comma) +
theme(legend.position = "right")
ggplotly(p)
```