Skip to content
Back to formatted view

Raw Message

Message-ID: <15692f300803250948i72dc34cbuee580440491accce@mail.gmail.com>
Date: 2008-03-25T16:48:33Z
From: Tribo Laboy
Subject: Combining several mappings in ggplot2

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