Skip to content

ggplot2: legend for geom_rug() ..?

1 message · Hadley Wickham

#
On Thu, Jun 7, 2012 at 9:30 AM, Tim Smith <tim_smith_666 at yahoo.com> wrote:
Here's one way:

ggplot(mdat, aes(position, value)) + geom_point(aes(colour = Treatment)) +
        geom_rug(subset = .(position < 14),aes(y=NULL, color="<14") +
        geom_rug(subset = .(position > 14),aes(y=NULL, color=">14") +
        scale_colour_manual(values = c("<14" = "orange", ">14" = "black")

Hadley