I am using ggplot and posted this question at that helplist. It was
suggested that I try a more general R-help list for a possible solution to
this problem.

Within ggplot, I am using geom_area with red and blue and expect where they
overlap should be purple. But instead, it's dark red.

Playing with alpha and with different colors doesn't seem to solve the
problem.

Here's a very simple reproducible example

R --arch x86_64

library(ggplot2)

x<-c(24,55,69,73)
y<-c(44,56,12,90)
z<-c(1,2,3,4)
a<-data.frame(pos=z, y=y, x=x)

ex<- ggplot(data=a, aes(pos)) +
geom_area(aes(y = y),fill="navyblue", alpha = 0.7, position="identity") +
geom_area(aes(y = x), fill= "darkred", alpha = 0.7,position="identity" ) +
opts(panel.background = theme_rect(fill = "white"))

ex

Likewise, with blue and yellow, I would expect overlap to be green.
Are there any solutions to this that would allow color overlaps to lead to
the "expected" color?
Thank you.

> sessionInfo()
R version 2.10.0 (2009-10-26)
x86_64-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] ggplot2_0.8.3 reshape_0.8.3 plyr_0.1.9    proto_0.3-8

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to