Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use shingles from lattice in ggplot2 in R

It is possible to use the shingles to define specific ranges in ggplot2. As far as i understand shingles are a way to generate groups. Can we create such shingles and use them in ggplot2 facet_grid to obtain graphs?

like image 1000
Sam Avatar asked Mar 04 '11 20:03

Sam


1 Answers

Following up from the comments, ggplot can't draw shingles (in the way lattice draws shingles with special indicators in the strip) and by default doesn't have a means of producing the overlapping groups.

However, I cam across this excellent PDF document which aims to produce a gpplot2 version of every figure in Depayan's excellent Lattice book (Lattice: Multivariate Data Visualization with R).

Page 31 contains a custom function fn() which replicates the behaviour of equal.count(), as far as I can tell, to provide the correct data structure to plot with overlapping shingles. The PDF contains plenty of examples of "shingles" in ggplot that you can play with.

So not sure if this answers the Q - but at least it appears one can fudge ggplot into producing plots that use the shingle concept.

like image 158
Gavin Simpson Avatar answered Oct 22 '22 03:10

Gavin Simpson