library(bangladesh)

country <- get_map("country")
division <- get_map("division")
district <- get_map("district")
upazila <- get_map("upazila")
union <- get_map("union")
plot(country[1])

plot(division[1])

plot(district[1])

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
# Create subset for Ramna and Jatrabari
Barisal <- district %>%
  filter(Division %in% c("Barisal"))

plot(Barisal[1])

library(dplyr)

# Create subset for Ramna and Jatrabari
Barisal <- upazila %>%
  filter(Division %in% c("Barisal"))

plot(Barisal[1])

library(tmap)
library(bangladesh)
division <- get_map("division")
tm_shape(division) +
  tm_polygons()

tm_shape(division) +
  tm_polygons(fill = "Division") +
  tm_title("Divisions of Bangladesh")

tm_shape(division) +
  tm_polygons(fill = "Division") +
  tm_title("Divisions of Bangladesh")

tm_shape(division) +
  tm_polygons(fill = "Division") +
  tm_title("Administrative Divisions of Bangladesh") +
  tm_text("Division")
## [plot mode] fit legend/component: Some legend items or map compoments do not
## fit well, and are therefore rescaled.
## ℹ Set the tmap option `component.autoscale = FALSE` to disable rescaling.

tm_shape(division) +
  tm_polygons(fill = "Division") +
  tm_title("Administrative Divisions of Bangladesh") +
  tm_text("Division") +
  tm_compass(position = c("left", "bottom"), type = "8star", size = 5) +
  tm_scalebar(position = c("right", "bottom"), text.size = 0.7)
## [plot mode] fit legend/component: Some legend items or map compoments do not
## fit well, and are therefore rescaled.
## ℹ Set the tmap option `component.autoscale = FALSE` to disable rescaling.

tm_shape(division) +
  tm_polygons(fill = "Division") +
  tm_title("Administrative Divisions of Bangladesh") +
  tm_text("Division") +
  tm_compass(position = c("left", "bottom"), 
type = "8star", size = 5)
## [plot mode] fit legend/component: Some legend items or map compoments do not
## fit well, and are therefore rescaled.
## ℹ Set the tmap option `component.autoscale = FALSE` to disable rescaling.

tm_shape(division) +
  tm_polygons(fill = "Division") +
  tm_title("Administrative Divisions of Bangladesh") +
  tm_text("Division") +
  tm_compass(position = c("left", "bottom"), 
type = "8star", size = 5)
## [plot mode] fit legend/component: Some legend items or map compoments do not
## fit well, and are therefore rescaled.
## ℹ Set the tmap option `component.autoscale = FALSE` to disable rescaling.

tm_shape(division) +
  tm_polygons(fill = "Division") +
  tm_title("Administrative Divisions of Bangladesh") +
  tm_text("Division") +
  tm_compass(position = c("left", "bottom"), type = "8star", size = 5) +
  tm_scalebar(position = c("right", "bottom"), text.size = 0.7)+
  tm_grid(lines = TRUE, labels.size = 0.8, col = "gray90")
## [plot mode] fit legend/component: Some legend items or map compoments do not
## fit well, and are therefore rescaled.
## ℹ Set the tmap option `component.autoscale = FALSE` to disable rescaling.

ttmp()
## ℹ tmap modes "plot" - "view"
## ℹ toggle with `tmap::ttm()`