I am still working with ggplot, and I would like to know if it is possible to achieve some effects. With this dataframe:
visits <- data.frame(
stringsAsFactors = FALSE,
Mth = c("01-2019","02-2019","03-2019",
"04-2019","05-2019","06-2019","07-2019","08-2019",
"09-2019","10-2019","11-2019","12-2019","01-2020",
"07-2020","08-2020","09-2020","10-2020","04-2021",
"05-2021","06-2021","07-2021"),
Nat = c(3705L,4983L,5139L,6123L,
6407L,7426L,9030L,12579L,7332L,7990L,5772L,5216L,
3943L,5007L,8816L,5540L,4831L,4693L,4317L,3977L,
10910L),
Ext = c(238L,160L,601L,1915L,3823L,
3241L,2277L,2487L,3803L,3888L,526L,364L,413L,
225L,531L,254L,334L,60L,393L,421L,2097L)
And this code:
ggplot(data = visits) +
aes(x=Mth, group=1) +
scale_x_discrete (limits = c("04-2019","05-2019","06-2019","07-2019","08-2019","09-2019","10-2019","11-2019",
"12-2019","01-2020","07-2020","08-2020","09-2020","10-2020","04-2021", "05-2021", "06-2021", "07-2021")) +
scale_y_continuous (limits = c(0000, 14000), breaks = seq(0000, 14000, by = 2000),
labels = function(x) format(x, big.mark = ".", decimal.mark = ",")) +
geom_line(aes(y = Nat), color = "darkred") +
geom_line(aes(y = Ext), color="steelblue", linetype="twodash") +
labs(x="", y="Visits",
title="Visits evolution",
subtitle="From april 2019 to july 2021",
caption="") +
theme_ipsum()
I get this:
I would like to get this (it is a recreation with photoshop, I have not been able to do it with R).
is it possible? Also, does anyone know why I don't see the legend on the graph?
Thanks for your help