Hi,
I would like to know how to add a border to my plot on only one side. I have this plot:
library(ggplot2)
p <- ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
theme_minimal() +
labs(title = "Title",
subtitle = "Subtitle")
p
Created on 2019-12-21 by the reprex package (v0.3.0)
I would like to add a horizontal line above the title, like this:
I cannot figure out how to do this. I have tried theme(plot.background = element_rect())
, but this adds a border on all sides of the plot.
Please note that I am looking for a general solution to this problem. Using annotations in which the location of the line is expressed in terms of the data values may not work for my purposes.
Thank you