Re: [R] [GGPLOT] Legends at different layers

2009-12-26 Thread Megh
Hi Hadley, recently I run this code however got following error (this error seems not be there at 1st time) : > dat <- data.frame(x = rnorm(100)) > dat1 <- data.frame( + x = c(0,0), + y = c(1,0), + Label = c("Point1", "Point2") + ) > > > ggplot(dat, aes(x)) + + geom_histogra

Re: [R] [GGPLOT] Legends at different layers

2009-12-07 Thread hadley wickham
You mean: dat <- data.frame(x = rnorm(100)) dat1 <- data.frame( x = c(0,0), y = c(1,0), Label = c("Point1", "Point2") ) ggplot(dat, aes(x)) + geom_histogram(aes(fill = ..count..)) + geom_point(aes(x, y, colour = Label), data = dat1, size = 4) + scale_fill_gradient("Count", low = "gre

[R] [GGPLOT] Legends at different layers

2009-12-07 Thread Megh
Here I have following code : dat = rnorm(100) ggplot() + geom_histogram(aes(dat, fill=..count..)) + scale_fill_gradient("Count", low="green", high="red") + opts(legend.position="none") # Above is without any legend ## Now I want to place two points with legends dat1 <- data.frame(c(0,0), c(1,0))