[R] ggplot2 legend for vertical lines

From: baptiste Auguié <ba208_at_exeter.ac.uk>
Date: Thu, 03 Jul 2008 09:01:33 +0100

Dear all,

The following example code produces a graph with ggplot2, to which I add several vertical lines of arbitrary colors. I am not satisfied with the legend: it automatically adds some vertical lines which I'd rather not see (they confuse the reader rather than add information in this case).

> library(ggplot2)
> dfr <- data.frame(values = sin(1:50/10),
> fact = rep(c("short", "long"), each=25, length=50),
> fact2 = rep(1:10, length=50))
> p <- qplot(fact2, values, data=dfr, colour=fact)
> p + geom_vline(intercept=c(5), colour = 1) +
> scale_shape_manual(name="fact", values=1) # tried this, but useless
> here

Any tips on changing these settings would be welcome!



Baptiste Auguié

Physics Department
University of Exeter
Stocker Road,
Exeter, Devon,

Phone: +44 1392 264187


R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 03 Jul 2008 - 08:56:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Jul 2008 - 14:31:03 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive