Hi,

I was trying to get a graph in lattice with the following data frame (7 rows, 5 
cols):
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
I wanted the panels to be organized by 'chr' - which is ok. Further, I wanted 
the lines to be discontinuous. For example, in the first row, the x co-ordinate 
starts with a value of 10 (2nd column) and ends with a value of 20 (3rd 
column). The corresponding y value for this range of x values is 1.5 (4th 
column). Similarly, for the same panel (i.e chr=1), the fourth row would have x 
co-ordinate range from 35 to 70 with a y co-ordinate of 3.
If it were only one panel, a similar result could be achieved for the data x2:
> x2
  chr start1 end1 meth positive
1   1     10   20  1.5        y
4   1     35   70  3.0        y
5   1    120  140 -1.3        n
6   1    180  190  0.2        y


## Code courtesy of BAPTISTE AUGUIE
library(ggplot2)
ggplot(data=x2) +
 geom_segment(aes(x=start1, xend=end1, y=meth, yend=meth))
- Can I get lattice to do a similar graph for the panels?
thanks!


      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to