Skip to content
Prev 95611 / 398500 Next

ggplot: a new system for drawing graphics in R

I think the ggplot package is extremely promising.
Parts of the dokumentation are very good alread, e.g I recently managed 
to write my first own grob function.
One thing I am missing in the dokumentation is a little more detail on 
how to modify the colours of a plot.
Specifically, if I have:

  xx<-"x y g bar
1 1 1 1
1 5 2 3
2 3 1 3
2 4 2 2"
df=read.table(textConnection(xx),header=T);df
  ggplot(df, aes=list(y=y, x=factor(x),bar=bar))->p
  ggbar(p, aes=list(fill=g,barcolour=g+1), avoid="dodge", sort=TRUE)

... I get a beatiful barplot, but would like to change the colors of the 
bars. I tried

?scfill

and did not understand too much of the help file.
I think some more examples would do it.

Timm

hadley wickham schrieb: