R Markdown
library(ggridges)
library(ggplot2)
library(viridis)
## Loading required package: viridisLite
library(hrbrthemes)
## NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
## Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
## if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
unemployment = read.csv('/Users/yangweijie/Desktop/unemployment.csv')
ggplot(unemployment, aes(x = `Unemployment.Rate.in.London`, y = `Year`, fill = ..x..)) +
geom_density_ridges_gradient(scale = 2.5, rel_min_height = 0.01) +
scale_fill_viridis(name = "Rate(%)", option = "D") +
labs(title = 'Unemployment Rate in London (2010-2020)') +
labs(x="Unemployment Rate(%)",y="Year") +
theme(
legend.position="none",
panel.spacing = unit(0.2, "lines"),
strip.text.x = element_text(size = 8)
) + theme_ipsum()
## Picking joint bandwidth of 0.171
