control stacked area colors

6 views
Skip to first unread message

emorway

unread,
Sep 28, 2010, 2:17:01 PM9/28/10
to ggplot2
Hello,

I don't see a way to append plot images to this post, which I bring up
since a picture can be worth a thousand words...

In the following command I would like to have control over the colors
used for each of the stacked areas:
qplot(as.Date(upflx.vols.melt$date,"%Y-%m-
%d"),value,data=upflx.vols.melt,geom="area",fill=variable)

So for example, if I try:
qplot(as.Date(upflx.vols.melt$date,"%Y-%m-
%d"),value,data=upflx.vols.melt,geom="area",fill=variable,col=c("blue","red","darkgreen","darkviolet"))

The stacked areas are outlined with the specified colors. The
question is, how can I specify the colors used to fill the stacked
areas with out using a gradient scheme?

Thanks,
Eric

Brandon Hurr

unread,
Sep 28, 2010, 2:50:37 PM9/28/10
to Ben Bolker, emorway, ggplot2
Here's an example...

ggplot(diamonds, aes(x=clarity)) + geom_bar(aes(fill=cut))

ggplot(diamonds, aes(x=clarity)) + geom_bar(aes(fill=cut))+scale_fill_manual(values=c("red", "orange", "yellow", "blue", "purple"))

It's pretty amirite?

Brandon

On Tue, Sep 28, 2010 at 19:36, Ben Bolker <bbo...@gmail.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 scale_fill_manual() ?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyiNZcACgkQc5UpGjwzenO3jwCfdBzdTdaB7u1QkoPG1mrpASD7
mo0Ani7sGZ52QURm3h2poqbZqG2kWBvQ
=RsOh
-----END PGP SIGNATURE-----

--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442

To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

Awesome.graph.png
Normal.graph.png

Ben Bolker

unread,
Sep 28, 2010, 2:36:07 PM9/28/10
to emorway, ggplot2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10-09-28 02:17 PM, emorway wrote:

scale_fill_manual() ?

Reply all
Reply to author
Forward
0 new messages