Re: [R] ggplot2 - legend for fill coulours

From: Pedro de Barros <>
Date: Tue, 01 Apr 2008 20:58:12 +0100


Thanks a lot!

BTW, do you have any document explaining the object philosophy of ggplot? I was trying to see how you defined scale_fill_identity, but could not find it...

At 19:50 2008/04/01, hadley wickham wrote:
> > However, it looks this works only when the data are in the sequence
> > of the levels in the factor defining the fill colours. When the
> > sequence is different, the legend gets "scrambled", in that the order
> > of the colours does not match the labels.
>You can fix this by explicitly specifying the breaks to use in the
>identity scale:
> + scale_fill_identity(labels=levels(plotdata2$group),
>That way there's no confusion about how the values and their labels match up.
> mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 01 Apr 2008 - 20:00:45 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 Tue 01 Apr 2008 - 20:30:35 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive