Plot time serie over the years and add quarters as vertical lines in the plot


I am plotting sales over years of variable x over the years. I already have a variable "quarters" indicating quarter 1,2,3 or 4.

With the following code i plotted unit sales over the years:

ggplot(data = hoogvliet_tess ,aes(x=date, y=UnitSales)) +
  geom_line() + ggtitle("UnitSales x over the years")

Is there a possibility to extent the plot with for example vertical lines indicating the quarters of every year?

With kind regard,

Can you post some of your data so others can use your ggplot code? The output of the dput() function is a good way to share data. To provide the first 20 rows of data, run

dput(head(hoogvliet_tess, 20))

and post the output here. You can adjust the 20 value to whatever makes sense with your data.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.