[R] Discontinuous graph
    Steve Lianoglou 
    mailinglist.honeypot at gmail.com
       
    Mon Nov 16 19:09:01 CET 2009
    
    
  
On Nov 16, 2009, at 12:58 PM, David Winsemius wrote:
> On Nov 16, 2009, at 12:40 PM, Tim Smith wrote:
>
>> Hi,
>> I wanted to make a graph with the following table (2 rows, 3  
>> columns):
>> a b c
>> x 1 3 5
>> y 5 8 6
>> The first column represents the start cordinate, and the second  
>> column contains the end cordinate for the x-axis. The third column  
>> contains the y-axis co-ordinate. For example, the first row in the  
>> matrix above represents the points (1,5),(2,5), (3,5). How would I  
>> go about making a discontinuous graph ?
>>
>> thanks!
>
> coords <- read.table(textConnection("a b c
> x 1 3 5
> y 5 8 6"), header=TRUE)
>
> plot(NULL, NULL, xlim = c(min(coords$a)-.5, max(coords$b)+.5), ylim=c 
> (min(coords$c)-.5, max(coords$c)+.5)  )
> apply(coords, 1, function(x) segments(x0=x[1],y0= x[3], x1= x[2],  
> y1=x[3]) )
Oh, *that* kind of graph!
... my high-school English teacher once said that "all communication  
is miscommunication" because we each interpret things according to our  
own experiences, etc ... I guess that goes to show:
   (i) me that he was right (once again);
   (ii) you what I've been working on lately :-)
Sorry for the line-noise,
-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
    
    
More information about the R-help
mailing list