[R] specifying colours in a ggplot2 piechart
jrkrideau at yahoo.ca
Tue Nov 23 20:18:37 CET 2010
Obviously I cannot type or spell.
Your solution was great but do you have any idea why
does not work. More typos on my part or am I misunderstanding what scale_colour_manual(value=mycolours) is supposed to do?
--- On Tue, 11/23/10, baptiste auguie <baptiste.auguie at googlemail.com> wrote:
> From: baptiste auguie <baptiste.auguie at googlemail.com>
> Subject: Re: [R] specifying colours in a ggplot2 piechart
> To: "John Kane" <jrkrideau at yahoo.ca>
> Cc: r-help at stat.math.ethz.ch
> Received: Tuesday, November 23, 2010, 2:02 PM
> fixing the various typos in your
> code, this works,
> lat_plot() +
> On 23 November 2010 19:47, John Kane <jrkrideau at yahoo.ca>
> > Someone was asking how to do a 16 category piechart in
> OpenOffice Calc and it appears that it can not be done
> (which we, probably, should be happy about) but I thought
> that I'd try it in ggplot2.
> > It works but I then thought I'd like to make the
> colours more distinctive but fro some reason I don't seem to
> be able to use manually assigned colours.
> > Can anyone suggest where I'm going wrong?
> > Thanks
> > library(ggplot2)
> > mypie <- data.frame(xx = c(12,13,6,7,9,10,4, 3, 8,
> 6, 8, 4, 6,5,2,3),
> > zz = letters[1:16])
> > mycolours <- c(a = "red", b = "blue", c =
> "green", d = "orange", e = "red",
> > f = "blue", g = "geen", h = "orange", i = "red", j
> = "blue",
> > k = "green", l = "orange", m = "red", n = "blue", o
> = "green",
> > p = "orange" )
> > pie1 <- ggplot(mypie, aes(x = factor(zz), fill =
> factor(zz))) + geom_bar(width = 1)
> > pie2 <- pie + coord_polar(theta = "x") +
> > pie2
> > # try to get even nastier piechart with ugly colours
> to provide rast.
> > pie3 <- pie2 +
> > pie
> > ______________________________________________
> > 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.
More information about the R-help