Well time to confess ...
The problem is with the learner (me) not the teacher (Hadley). There is no
bug. I did not reproduce what Hadley wrote, but sorting it out got me a step
closer to the top of the mountain. I had two mistakes in the code I posted: 1)
color must be inside the aes() func
Hi:
I get the same result as you did. Perhaps the problem is the failure to
define breaks in the scale code. The issue, of course, is to figure out what
should be the breaks...
One approach is to go back into the data, add variables below and above,
melt the data frame to stack below and above in
Hi robert,
It's not a typo, i have the book and the right code is :
huron <- data.frame(year=1875:1972,level=LakeHuron)
p <- ggplot(huron, aes(year)) +
geom_line(aes(y= level - 5, colour = 'blue')) +
geom_line(aes(y= level + 5, colour = 'red'))
print(p)
So colour must inside aes
--
Vi
According to Hadley's ggplot book (p. 109), both the graphs below should have a
legend, and yet none appears in my hands.
Any suggestions? I can't see a typo. Is there a bug?
library(ggplot2)
data(LakeHuron)
huron = data.frame(year=1875:1972,level=LakeHuron)
p = ggplot(huron, aes(year)) +
4 matches
Mail list logo