library(tidyverse)
library(sf)
Overview
US Map
of Artists by states distribution. Data is from TidyTuesday
2022 week 39 US Artists
.
# set the fonts
library(showtext)
library(sysfonts)
library(extrafont)
::showtext_auto()
showtext::showtext_opts(dpi=320)
showtextfont_add_google(name="Syne Mono",
family="Syne Mono")
<- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-09-27/artists.csv')
artists
<- map_data("state")
states
<- rnaturalearth::ne_states(country ="united states of america",
states returnclass = "sf") %>%
filter(!name=="Alaska")
%>%
statesggplot()+
geom_sf()
<- artists%>%
my_states count(state)%>%
pull(state)
<- artists%>%
artists1 rename(name=state)%>%
group_by(race) %>%
mutate(artists_avg=log10(mean(artists_n,na.rm = TRUE)))%>%
ungroup()
%>%DataExplorer::profile_missing() artists1
<- states %>%
full filter(name%in%my_states) %>%
merge(artists1,by="name")
%>%
full ggplot()+
geom_sf(aes(fill=artists_avg))+
::scale_fill_scico("N.Artists")+
scicocoord_sf(xlim = c(-130,-60))+
labs(title="US Artists",
subtitle="states distribution by avg numbers (log tranf)",
caption = "#30DayMapChallenge 2022 Day 27: Music\nDataSource: #TidyTuesday 2022 week 39 US Artists | Map: Federica Gazzelloni (@fgazzelloni)")+
::theme_map()+
ggthemestheme(text = element_text(family="Syne Mono"),
legend.background = element_blank(),
plot.background = element_rect(color="#6b493e",linewidth=1.5))
ggsave("day27_music.png",
dpi=280,
width = 8.47,
height =5.07)