Obviously I cannot type or spell. Your solution was great but do you have any idea why scale_colour_manual(value=mycolours) does not work. More typos on my part or am I misunderstanding what scale_colour_manual(value=mycolours) is supposed to do?
Thanks --- On Tue, 11/23/10, baptiste auguie <baptiste.aug...@googlemail.com> wrote: > From: baptiste auguie <baptiste.aug...@googlemail.com> > Subject: Re: [R] specifying colours in a ggplot2 piechart > To: "John Kane" <jrkrid...@yahoo.ca> > Cc: r-h...@stat.math.ethz.ch > Received: Tuesday, November 23, 2010, 2:02 PM > fixing the various typos in your > code, this works, > > lat_plot() + > scale_fill_manual(value=mycolours) > > HTH, > > baptiste > > On 23 November 2010 19:47, John Kane <jrkrid...@yahoo.ca> > wrote: > > 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") + > scale_colour_brewer(Pastel1) > > pie2 > > > > # try to get even nastier piechart with ugly colours > to provide rast. > > > > pie3 <- pie2 + > scale_colour_manual(value=mycolours) > > pie > > > > ______________________________________________ > > R-help@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. > > > ______________________________________________ R-help@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.