Hi,
I'm also having the same issue: I cannot get geom_hline or geom_vline
to work
correctly with facet grids. I tried creating a data frame to map the
facet
factors to the appropriate x or y intercepts, as in the example for
geom_hline
in the documentation, but always get lines at zero. I also tried
modifying the
original data frame to include these values, but the result is the
same.
Is this a bug - if so is there any way I can work around it? I have a
density
plot with three facets and need a different vertical line on each. Can
I
somehow directly select each facet individually and draw the lines on
them?
Thanks!
Kevin
On Apr 29, 10:10 am, a11_msp <
absorbt...@gmail.com> wrote:
> Hi,
>
> sorry for flooding the forum with posts over the last several days -
> just need to make quite a complex figure, for which ggplot2 seems to
> be the library of choice...
>
> I'm trying to reproduce the example from the website:
>
> # To display different lines in different facets, you need to
> # create a data frame.
> p <- qplot(mpg, wt, data=mtcars, facets = vs ~ am)
>
> hline.data <- data.frame(z = 1:4, vs = c(0,0,1,1), am = c(0,1,0,1))
> p +geom_hline(aes(yintercept = z), hline.data)