On 12/10/2012 5:01 AM, jrr wrote:
> Thank you Brian. I am having some difficulty with the documentation
> of ggplot2. If I ?signif I get help for base R function.
That's the one that I was referring to.
> However, if I ?label I get nothing. Where are the "aes(label="
> parameters documented, and the special variable ..fun.. and other
> special variables.? The R help documentation of aes is very cursory,
> as is the documentation for stat_summary, and other ggplot2 aspects.
> It seems that one must get most documentation from user groups.
Since label is the name of an argument, it is not surprising that it
does not have its own help page. The help for aes is sparse; the
descriptions of the various aesthetics and what they are/do are in
aes_colour_fill_alpha, aes_group_order, aes_linetype_size_shape, and
aes_position. Unfortunately, label is not described in any of these. The
geoms also have documentation (well, examples) about their individual
aesthetics. For geom_text, label is the actual characters/text drawn or
written.
I could not find any documentation about the special variables in the
standard online documentation. The relevant statement from the ggplot2
book, page 58-59, is:
The names of generated variables [by stats] must be surrounded with
.. when used. This prevents confusion in case the original dataset
includes a variable with the same name as a generated variable, and
it makes it clear to any reader of the code that this variable was
generated by a stat. Each statistic lists the variables that it
creates in its documentation.
In stat_summary, the additional columns are documented as fun.data,
fun.ymin, fun.y, and fun.ymax, though in this case, that documentation
is not right. The actual names are either set by the function called
(for fun.data) or are ymin, y, ymax for the other three. (Also, fun.data
takes a vector, not a data.frame, despite the documentation.)
For an example, this is a generic usage of stat_summary:
ggplot(mtcars, aes(x=cyl, y=mpg)) +
stat_summary(fun.ymax = max, fun.y = mean, fun.ymin = min)
But with a different geom, different aesthetics can be set:
ggplot(mtcars, aes(x=cyl, y=mpg)) +
stat_summary(fun.ymax = max, fun.y = mean, fun.ymin = min,
geom="text", aes(label=..y.., colour=..ymax..))
Not that this is a necessarily practical graph, but it shows how things
are used.
I agree that this would be hard to put together from the online
documentation.