I am trying to create something like this:
Insired by this question i tried the following, but i does not work:
claims_freq <- c(0.1,0.3,0.2,0.7,0.1)
claims_sev <- c(10000, 12000, 14000, 16000, 1600)
year <- c(2015, 2016, 2017, 2018, 2019)
data <- cbind(claims_freq, claims_sev, year)
data <- as.data.table(data)
twoord.stackplot(lx=data$year, rx=data$year,
ldata=cbind(data$claims_freq),
rdata=cbind(data$claims_sev),
lcol=c("black"),
rcol=c("black"),
ltype=c("l"),
rtype=c("bar"),
lylab="freq", rylab="sev",
xlab="year",
main="Freq/Sev 2015-2020",
border="grey80")
is it possible to do this in ggplot
?