Re: [R] ggplot2 fill problem in colour shading

2019-08-11 Thread David Winsemius
> On Aug 11, 2019, at 9:13 AM, Troels Ring wrote: > > Dear friends - I have 2 problems with ggplot2 > > Here is the code for illustration > > > > x <- seq(1,10,length=1) > > y <- x^2 > > fill <- rep(0,length(x)) > > fill[(5 > ddf <- data.frame(x,y,fill) > > ggplot(data=ddf,aes(x=x

Re: [R] ggplot2 fill problem in colour shading

2019-08-11 Thread Rui Barradas
Hello, You must put the NA in scale_fill_manual. Like this: ggplot(data = ddf, aes(x = x, y = y)) + geom_area(aes(fill = fill)) + geom_line() + scale_fill_manual(values = c(NA, "red")) Note also that 'fill' is a factor, were it numeric you would need fill = factor(fill). ddf2 <- data

[R] ggplot2 fill problem in colour shading

2019-08-11 Thread Troels Ring
Dear friends - I have 2 problems with ggplot2 Here is the code for illustration x <- seq(1,10,length=1) y <- x^2 fill <- rep(0,length(x)) fill[(5https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide comment