On Fri, Feb 13, 2009 at 1:22 PM, Dieter Menne
<dieter.me...@menne-biomed.de> wrote:
> Dimitri Liakhovitski <ld7631 <at> gmail.com> writes:
>
>> the code below works just fine to produce a dotplot. However, I am not
>> successful changing the color of the lines in the legend (auto.key).
>> If I add col=..., it only changes the color of the letters in the
>> legend, but not the color of the lines.
>
> I prefer to set pch and friends outside the panel function to
> avoid clutter, and to set the parameters globally, thus forcing
> my plots to be similar. This is a matter of taste, though.
>
> On Windows, the key looks a bit ugly now.
>
> Group 1 o ----
> Group
> 2       o-----
>
> I am not very happy that the lwd is not honored by the key.
> Lines in lwd 2 (plot) and in lwd 1 (default key) do have a quite
> different subjective color hue. Any way around this, Deepayan?
>
> (Besides using ggplot2, as Hadley would argue ??)

And here is a ggplot2 solution ;)

df <- data.frame(
  x = rep(d[[2]], 2),
  y = c(d[[1]], d[[3]]),
  group = rep(c("Group 1", "Group 2"), each = 3)
)

ggplot(df, aes(x, y, group = group)) +
  geom_point(aes(colour = group), size = 3) +
  geom_line(aes(colour = group), size = 1.5) +
  geom_text(aes(label = y, y = y + 0.02), vjust = 0, size = 4)

The legends are pretty good at figuring out exactly what should be
displayed, based on what you've used in the graphic.

Hadley

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

______________________________________________
R-help@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.

Reply via email to