Reputation: 5504
Here is a code example (based on random data):
lattice::bwplot(runif(1000) ~ cut(runif(1000), c(0,0.3,0.6,1)) | as.factor(c(1,2,3)),
groups = sample(1:2, 1000, replace = TRUE), auto.key = TRUE)
The output:
I am expecting to get 6 boxplots in each panel due to groups
, but I only get 3. At the top is the legend: one sees two colors representing 2 groups but you don't see these in the pannels.
How can I get 6 boxplots in each panel, one for each interval and for each group in the correct color?
Upvotes: 1
Views: 861
Reputation: 3694
The groups
argument in bwplot()
doesn't do much other than affect the key unfortunately. I wrote a modified bwplot()
in my tactile package.
Try:
tactile::bwplot2(runif(1000) ~ cut(runif(1000), c(0,0.3,0.6,1)) | as.factor(c(1,2,3)),
groups = sample(1:2, 1000, replace = TRUE), auto.key = TRUE)
Upvotes: 4