I'm trying to draw 2 maps using a different dataset for each one of them, but the same shapefiles.
This is an example of dataset 1
#dataset1
COD_PROV Real Wage
1 530
1 520
1 410
2 300
2 205
2 501
13 700
13 800
13 900
18 440
18 590
18 620
19 340
19 590
19 320
and this is and example of dataset2
COD_PROV PPP Wage
1 130
1 620
1 510
2 400
2 255
2 601
13 754
13 600
13 950
18 350
18 690
18 520
19 640
19 790
19 720
The shapefiles are in a directory and I've no ideaa how to upload them.
However, you are going to find them in the script as prov2022
.
COD_PROV
is the code of each area of the map
This is the script I'm using for MAP 1
right_join(prov2022, dataset1, by = "COD_PROV") %>%
ggplot(aes( fill = `Real Wage` >= 400 & `Real Wage` <= 800)) +
geom_sf() +
theme_void() +
theme(legend.position = "none", legend.title=element_blank())+
scale_fill_manual(values = c('white', 'orange'))
and this is the script I'm using for MAP 2 ( the shapefiles are the same, but the dataset is different)
right_join(prov2022, dataset2, by = "COD_PROV") %>%
ggplot(aes( fill = `PPP Wage` >= 400 & `Real Wage` <= 800)) +
geom_sf() +
theme_void() +
theme(legend.position = "none", legend.title=element_blank())+
scale_fill_manual(values = c('white', 'orange'))
Is there a way to overlap these 2 maps in a unique one, but leaving filled only the areas that have the values in common (in this case when Real Wage >= 400 & Real Wage < 800
coincides with PPP Wage >= 400 & PPP Wage < 800
) and left all the other uncolored (or white) ?
To give you an example
The orange ones are the MAPS of my script, while the red one is what I'm looking for... Is it possible to do it?