[R] ggplot2 histogramm

Christian Schulz chschulz at email.de
Mon Jan 18 13:34:22 CET 2010


Hi,

i get no success change the title of the "fill" (colour) legend and the 
defintion of "levels". Have anybody a hint how i can do this.

df <- 
data.frame(variable=sample(c("A","B","C"),1000,replace=T,prob=c(0.22,0.28,0.5)),group=gl(2,500))
p <- ggplot(df, aes(x = variable))
p + geom_histogram(aes(y= ..count.. / 
sum(..count..),fill=..count../sum(..count..)*100))  + 
scale_y_continuous(formatter = "percent") + facet_wrap(~group)  + 
ylab("Anteil in %") +  xlab("Attribute") + 
opts(title="Title",legend.text="Anteil in Prozent") + 
BaseTheme(base_size=12)

many thanks,
Christian



More information about the R-help mailing list