[R] ggplot, getting two scales and one stat.

hadley wickham h.wickham at gmail.com
Sat Sep 27 16:02:05 CEST 2008


On Sat, Sep 27, 2008 at 1:08 AM, Tylere Couture <tylerecouture at gmail.com> wrote:
> I have a simple plot:
>
> ggplot(polls, aes(x =Date, y = Popular_Support, colour=Party, shape=Source))
> +
> stat_smooth(span=0.5) +
> geom_point()
>
> How can I get the smooth to only render along one of the scales? ie, I want
> to see regressions for each colour, but not each shape.

Just map shape to source only for the points:

ggplot(polls, aes(x =Date, y = Popular_Support, colour=Party)) +
stat_smooth(span=0.5) +
geom_point(aes(shape=Source))

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list