> head(aa)
when glucose which
a.1 2008-03-04 08:53:00 108 a
a.2 2008-03-04 12:14:00 76 a
a.3 2008-03-04 16:55:00 82 a
a.4 2008-03-04 20:28:00 92 a
a.5 2008-03-04 23:18:00 79 a
a.6 2008-03-05 08:36:00 146 a
> tail(aa)
when glucose which
a4.415 2008-12-12 23:15:00 114 a4
a4.416 2008-12-13 10:17:00 79 a4
a4.417 2008-12-13 13:52:00 108 a4
a4.418 2008-12-13 19:10:00 220 a4
a4.419 2008-12-14 00:19:00 121 a4
a4.420 2008-12-14 09:32:00 81 a4
> qplot (glucose, geom="density", color=which, data=aa) +
scale_colour_manual("Time", breaks=c("a", "a4"), values=c("blue",
"red"), labels=c("Prior", "Current"))
But this doesn't change the key labels in the legend. It does change
the legend name and the colors of the two traces, so the
scale_colour_manual is having some effect, but the labels= isn't. I've
tried with and without the breaks=, and I've even tried putting
incorrect values in breaks= and too many items in labels=, all of
which does not change anything or cause any errors.
Am I just misunderstanding, or is there some kind of problem in that
the density plot features an implicit Y value instead of an explicit
one?
Wayne
> But this doesn't change the key labels in the legend. It does change
> the legend name and the colors of the two traces, so the
> scale_colour_manual is having some effect, but the labels= isn't. I've
> tried with and without the breaks=, and I've even tried putting
> incorrect values in breaks= and too many items in labels=, all of
> which does not change anything or cause any errors.
>
> Am I just misunderstanding, or is there some kind of problem in that
> the density plot features an implicit Y value instead of an explicit
> one?
There's a simple answer - there was a bug in scale_manual where the
labels argument was ignored. I've fixed that bug in the development
version, so it will be fixed in the next release.
Regards,
Hadley