[R] ggplot geom_line problem

phii m@iii@g oii phiiipsmith@c@ phii m@iii@g oii phiiipsmith@c@
Sun Aug 29 03:45:11 CEST 2021


I am preparing a time series plot using the ggplot function. It includes 
an area plot outlined at its edges with a line plot. For some reason the 
line plot, drawn with geom_line(), has some broken portions where the 
line does not appear, although the filled geom_area() part of the plot 
is shown. The problem is related to the last line of code because when I 
remove it, the problem disappears.
Why is this happening and what can I do about it? Thank you. Philip

library(tidyverse)
df <- dget("df.txt")
mnGr <- 345.666605809
mnGDP <- 859.752763485
ggplot(df)+
   geom_area(aes(x=Date,y=GDP*(mnGr/mnGDP)-Gr),
     fill="red",alpha=0.3)+
   geom_line(aes(x=Date,y=GDP*(mnGr/mnGDP)-Gr),
     colour="black",size=1)+
   scale_y_continuous(position="right",limits=c(-30,30))

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: df.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20210828/29dadc4e/attachment.txt>


More information about the R-help mailing list