Hi Dennis,
the BaseTheme() are some settings scale the text and title etc. , the
plot should work without that. At present i'm experiment with the huge
amount of possibilities and try to understand and maybe doing beginner
mistakes.
Thanks for the hint with scale_fill_gradient and specialized mailing list.
Regards ,
Christian
Hi:
I have to admit, there are several things about your call I don't
understand. First of all,
you're really constructing bar charts by group, not histograms.
Secondly, you don't want
legend.text, but legend.title; unfortunately, that doesn't work (for
reasons I don't understand),
so I put in a workaround with scale_fill_gradient(). Thirdly, I
couldn't find a function called
BaseTheme() in ggplot2; is this in package ggExtra?
I got some errors when running your code. The first one had to do with
BaseTheme (not found).
When I got rid of that, there was the following (in my modified code):
> p + geom_bar(aes(y= ..count.. /
sum(..count..),fill=..count../sum(..count..)*100)) +
+ scale_y_continuous("Anteil in %", formatter = "percent") +
+ facet_wrap(~ group) + xlab("Attribute") +
+ opts(title="Title")
> last_plot() + opts(legend.title = "Antiel in Prozent")
Error in el(...) : unused argument(s) (x = 0, y = 0.5)
(It happened in yours, too.) I got the following to work; I think it's
what you want, but let
me know if I'm off.
p + geom_bar(aes(y= ..count.. /
sum(..count..),fill=..count../sum(..count..)*100)) +
scale_y_continuous("Anteil in %", formatter = "percent") +
scale_fill_gradient("Antiel in Prozent", limits = c(0, 50)) +
facet_wrap(~ group) + xlab("Attribute") +
opts(title="Title")
HTH,
Dennis
PS: Questions about ggplot2 are better directed to its mailing list:
ggpl...@googlegroups.com <mailto:ggpl...@googlegroups.com>
On Mon, Jan 18, 2010 at 4:34 AM, Christian Schulz <chsch...@email.de
<mailto:chsch...@email.de>> wrote:
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
______________________________________________
R-help@r-project.org <mailto: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.