Dear ggplot'ers,
I'm trying to annotate a plot.
From the code below, I expected to see a red line running diagonally
partway across the plot.
What am I missing ... ?
(geom_abline is added here just as a separate trial, to ensure that
I really can add layers)
library(ggplot2)
t1 <- ggplot(data.frame(x=runif(10,max=30),y=runif(10,max=0.05)),
aes(x=x,y=y))+xlim(0,30)+ylim(0,0.05)+geom_point()
t1+geom_segment(data=NULL,x=1,x.end=20,y=0.01,y.end=0.04,linetype=2,colour="red")+
geom_abline(intercept=0,slope=0.01,colour="blue")
cheers
Ben Bolker
geom_segment(data=NULL,x=1,x.end=20,y=0.01,y.end=0.04,linetype=2,colour="red")
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
You shouldn't have to put the values in the aesthetics, but I think
there's a bug in that case where there is no data and all aesthetics
are set, not mapped.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
On 11/09/2010 02:37 PM, Hadley Wickham wrote:
>> Dear Ben, you forgot to make the aes call in geom segment and it's xend and
>> yend. No point in the middle.
>
> You shouldn't have to put the values in the aesthetics, but I think
> there's a bug in that case where there is no data and all aesthetics
> are set, not mapped.
>
> Hadley
>
>
Good to know I was only being a little bit boneheaded. Thanks for the
help everyone.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkzZpYIACgkQc5UpGjwzenODVACgkhdqvrKUKrd/2A0k/loFmYKL
U7MAn279vJ+RulJGLBBYMYQyCkTHFlIc
=CCd8
-----END PGP SIGNATURE-----