library(maps)
library(tidyverse)
Overview
This map of France
is created with data from the {maps}
R-package.
library(extrafont)
loadfonts()
library(showtext)
font_add_google("Schoolbell", "bell")
showtext_opts(dpi = 320)
showtext_auto(enable = T)
# set the colors
# source: https://www.rdocumentation.org/packages/colorspace/versions/2.0-2/topics/rainbow_hcl
<- function(col, radius = 1, ...)
wheel pie(rep(1, length(col)), col = col, radius = radius, ...)
wheel(rainbow(96))
# load the map data
<- map_data("france") france_map
<- ggplot() +
france_plotgeom_line(data =france_map,aes(x=long,y=lat,group=region,
color=factor(region)),show.legend = F,size=0.2)+
scale_color_manual(values = rainbow(96))+
labs(title="Regions of France",
#subtitle = "#30DayMapChallenge Day 2 - lines",
caption = "Datasource: maps R-package - Dataviz: Federica Gazzelloni\n#30DayMapChallenge Day 2 - lines")+
::theme_map()+
ggthemestheme(text = element_text(family = "bell"),
plot.title = element_text(size=40,family="bell",face="bold",vjust=-0.5,hjust=0.2),
#plot.subtitle = element_text(vjust=1,size=15,vjust=-10),
plot.caption = element_text(hjust=0.5,size=10,vjust=1),
plot.background = element_rect(color ="grey80",fill="grey80"),
plot.margin = margin(0,15,5,15,unit = "pt"))
# save final plot
::agg_png(here::here("/Users/federica/Documents/R/R_general_resourses/30DayMapChallenge/day2_lines/lines.png"),
raggres = 320, width = 6, height = 6, units = "in")
france_plotdev.off()