library(cartogram)
library(sf)
## Linking to GEOS 3.9.1, GDAL 3.4.3, PROJ 7.2.1; sf_use_s2() is TRUE
library(readxl)
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
library(ggplot2)
library(tmap)
library(tidyr)
setwd("C:/Users/User/Desktop/ASIGNATURAS MASTER/METODOLOGIA/region_potosi_2018")
potosi <- st_read("region_potosi_2018.geojson")
## Reading layer `region_potosi_2018' from data source
## `C:\Users\User\Desktop\ASIGNATURAS MASTER\METODOLOGIA\region_potosi_2018\region_potosi_2018.geojson'
## using driver `GeoJSON'
## Simple feature collection with 41 features and 10 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -68.77387 ymin: -22.90657 xmax: -64.71439 ymax: -17.80711
## Geodetic CRS: WGS 84
setwd("C:/Users/User/Desktop")
pocoata <- read_excel("Pocoata.xlsx")
potosi[10,6] = "Salar"
Mp <- merge(potosi,pocoata, by.x = "MUNICIPIO", by.y="Municipio")
Mapa <- ggplot(data = Mp) +
geom_sf(aes(fill=`Score` ), data = Mp, color='black', size=0.3) +
guides(fill=guide_colorbar(title = "Pocoata")) +
scale_fill_gradient(limits= c(0,1), high = "blue", low = "white", guide = "colorbar") +
ggtitle("Mapa de Pocoata en Potosí")+
theme_bw()+
theme(
axis.text.x = element_blank(),
axis.text.y = element_blank(),
axis.ticks = element_blank(),
axis.title = element_blank(),
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()
)
Mapa
