Skip to content

Lattice plot

3 messages · Tim Smith, Baptiste Auguie, Deepayan Sarkar

#
Hi,

ggplot2 can also split the graphs in different panels,

d=
read.table(textConnection(
"chr start1 end1 meth positive
1   1     10   20  1.5        y
2   2     12   18 -0.7        n
3   3     22   34  2.0        y
4   1     35   70  3.0        y
5   1    120  140 -1.3        n
6   1    180  190  0.2        y
7   2    220  300  0.4        y"), head=T)

library(ggplot2)
ggplot(data=d) + facet_grid(.~chr) +
 geom_segment(aes(x=start1, xend=end1, y=meth, yend=meth))


HTH,

baptiste


2009/11/17 Tim Smith <tim_smith_666 at yahoo.com>:
#
On Wed, Nov 18, 2009 at 4:14 AM, Tim Smith <tim_smith_666 at yahoo.com> wrote:
You could do it with

library(latticeExtra)
segplot(meth ~ start1 + end1 | factor(chr), bar, type = "g")

but as Baptiste said, ggplot2 can do conditioning just as well.

-Deepayan