[R] Combining several mappings in ggplot2

From: Tribo Laboy <tribolaboy_at_gmail.com>
Date: Tue, 25 Mar 2008 16:48:33 +0000


Hello,

I want to be able to make a plot that has several series with different color and linetype.
Online documentation suggest that this is possible, but I haven't found how:

"We can also create redundant mappings, mapping the same variable to multiple aesthetics. This is most useful when producing a graphic for both colour and black and white display."

Here's what I have to get the color
ggplot(data = Orange, aes(x = age, y = circumference, color = Tree)) + geom_line()

if i try this I get an error:
ggplot(data = Orange, aes(x = age, y = circumference, color = Tree, linetype = Tree)) + geom_line()

or
ggplot(data = Orange, aes(x = age, y = circumference, color = Tree)) + geom_line() + scale_linetype_manual(value = c(1:5))

I'd be grateful to get a suggestion of how to do this.

Regards,

TL



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 Tue 25 Mar 2008 - 16:52:20 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 25 Mar 2008 - 17:30:24 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