[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    Re: [R] ggplot geom_line problem
From:       phil () philipsmith ! ca
Date:       2021-08-29 12:06:10
Message-ID: 5656e298e1086549132f3df4440cbe19 () philipsmith ! ca
[Download RAW message or body]

Thank you Jeff. This solves my problem.

On 2021-08-28 21:54, Jeff Newmiller wrote:
> Maybe you will find that coord_cartesian( ylim=c(-30,30) ) works
> better since it doesn't filter out data before rendering.
> 
> On August 28, 2021 6:45:11 PM PDT, phil@philipsmith.ca wrote:
>> 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))

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic