About the data

GIS data for the U.S.-Mexico border fence (perhaps a wall in the future) Credits: Reveal from The Center for Investigative Reporting and OpenStreetMap contributors.

I downloaded the shapefile from this github account

library(tidyverse)
library(tmap)
library(sf)
library(tmaptools)
library(RColorBrewer)


tmap_mode("view")

m <- st_read("shp/border_fence_map.shp")

Map showing the type of fence, when it exists

tm_shape(m)  + tm_lines(col="gen_type",
                               style="pretty",
                        palette="Dark2",
                        title.col="General type of fence",
                        showNA = FALSE,
                        labels=c("Pedestrian", "Vehicle"),
                        popup.vars = c("seg_name"),
                        )

Map showing which government project the segment was built under

tm_shape(m) +
  tm_lines(col="project",
           style="pretty",
           palette="Set1",
           title.col="Project the segment built under",
           textNA="No wall recorded",
           popup.vars = "seg_name",
           labels=c("Legacy (prior to Secure Fence Act 06'",
                    "PF225 (Pedestrian Fence 225)",
                    "PF70 (Pedestrian Fence 70)",
                    "VF300 (Vehicle Fence 300"))

Check out more #dataviz projects on my twitter and github accounts.