I'm trying to map the different denominations of the pencil in France. With the following code, I can achieve the map I want, the different colors representing the different items, and the score the rate of use of each item per department/region.
ggplot() +
geom_polygon(data = plotDatafr, aes(x=long, y = lat, group = group, fill=item, alpha=score), colour = NA) +
scale_fill_manual(values = c("#009E73", "#F0E442", "#0072B2", "#D55E00"), name = "", na.value=NA) +
coord_map()
I m now trying to find a way to smooth a little bit the color transitions between departments/regions. The map here gives an idea of what I m trying to achieve. My data is here. I'm aware of this post and I tried to follow this tutorial, but none of them is helpful for my problem.
EDIT
To create the map above, I calculated for each department the percentage of answers for a given item (5 different items) according to the total number of participants for each department (8272 participants in total). For each department, I then selected the item that received the max percentage, and plot these items on the map. I provided in this folder the raw data of the survey.
Description of the data
"id_part": the participant ; "PLZ": the zipcode of the participant's city ; "Lat"/"Long": long and lat values of the participant's city ; "NOM_DEPT": the department/region where the participant's city is located ; The rest of the columns indicate the answers (5 choices)
Shapefile is provided in the folder, I used this code to join the data (after having calculated and extracted the item with max percentage for each department) with the shapefile:
library(rgdal)
mapa <- readOGR(dsn="France",layer="DEPARTEMENT")
mapa <- spTransform(mapa, CRS("+proj=longlat +datum=WGS84"))
mapa@data$id <- rownames(mapa@data)
mapa@data <- join(mapa@data, data, by="NOM_DEPT")
mapa.df <- fortify(mapa)
mapa.df <- join(mapa.df,mapa@data, by="id")
plotDatafr <- join(mapa.df, data)