Closed nicholasjhorton closed 6 years ago
group
in lattice is a mix of color/shape/fill/linetype/etc. depending on context and theme.
group
in ggformula
means something else, and you should specify which (perhaps multiple) of color, shape, fill, etc. you want mapped to a particular variable. I'm not sure group
in of interest with gf_histogram()
or gf_dhistogram()
.
I'm not sure what you meant by: "I'm not sure group in of interest"
I'm trying to replicate your lattice graph:
library(mosaic) NFL.null <- do(1000) * rflip(428) histogram(~ heads, groups=(heads >= 240), data=NFL.null)
gf_histogram(~ heads, fill = ~ (heads >= 240), data = NFL.null)
Does that clarify? I still think that an example would be useful to add.
"I'm not sure group in of interest with gf_histogram() or gf_dhistogram()." should have been "I'm not sure group is of interest with gf_histogram() or gf_dhistogram()."
group
is interesting for things like gf_line()
where it determines which points are connected (which may not be the same as the set of points that are the same color).
I'm not sure that group
is even used by gf_histogram()
. (I couldn't find it in the documentation, and some testing suggests that it doesn't do what I thought it might have done.)
I've added this example:
gf_histogram( ~ x, fill = ~(abs(x) <= 2), boundary = 2, binwidth = 0.25)
I've been happy with the "fill = ~ Z" option to replicate the old group functionality in xhistogram(). An example might be worthwhile.