If you want to change the fill colours, then you need to specify fill
instead of colour
ggplot(ageincgraph, aes(x = age, y = rate, fill = era)) +
geom_bar(position = "dodge", stat = "identity") +
scale_fill_manual(values=c("red","orange","yellow"))
------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
> -----Oorspronkelijk bericht-----
> Van: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] Namens nzcoops
> Verzonden: maandag 20 september 2010 11:16
> Aan: r-help at r-project.org
> Onderwerp: [R] ggplot2 - bar colour
>
>
> Hi All,
>
> I have trying to do what I thought was a reasonably simple
> graph but I think I'm now going in circles with the colour.
> Attached is a picture of where I'm up to.
>
> The line creating this is:
> qplot(ageincgraph$age, ageincgraph$rate, position="dodge",
> stat="identity", geom="bar" ) + aes(
colour=ageincgraph$era) +
>
scale_colour_manual(values=c("red","orange","yellow"))
>
> Data is:
>
> > ageincgraph
> era rate age
> 1 1995-1999 21.97 <6
> 2 1995-1999 11.21 6-12
> 3 1995-1999 16.64 >12
> 4 2000-2004 10.56 <6
> 5 2000-2004 10.71 6-12
> 6 2000-2004 17.49 >12
> 7 2005-2009 6.48 <6
> 8 2005-2009 6.55 6-12
> 9 2005-2009 7.35 >12
>
>
> Basically I'm after the ability to specify the fill colours
> and only seem to be able to do the outside colour. Using
> 'scale_fill_brewer(pal="Set1/2")'
> worked to change the colours but that only has limited
> options. The about qplot line is just where I got to after
> trying a fair few different combinations.
>
> Any help appreciated.
>
> Thanks
> http://r.789695.n4.nabble.com/file/n2546693/Screen_shot_2010-0
> 9-20_at_5.11.59_PM.png
> --
> View this message in context:
> http://r.789695.n4.nabble.com/ggplot2-bar-colour-tp2546693p254
> 6693.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>
Druk dit bericht a.u.b. niet onnodig af.
Please do not print this message unnecessarily.
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in this message
and any annex are purely those of the writer and may not be regarded as stating
an official position of INBO, as long as the message is not confirmed by a duly
signed document.