I have a time series I would like to plot in ggplot. I want to show that there's a break in the data at a certain point. I believe a good way to do this is by varying the line type (ie lty
). However, doing so makes an annoying break in the plot. Is there a way to connect these lines?
Here is some sample code of a time series at which there's a "break" where year == 0
:
df = tibble(year = -5:5, value=runif(11))
df$lty = df$year <= 0
ggplot(data=df, aes(x=year, y=value, lty=lty)) + geom_line()
I'm having difficulty uploading the resultant image, but it makes a line graph with a jump between year == 0
and year == 1
, which I don't want.
Thanks, smart people of the internet!!!