Thanks Baptiste. That is exactly what I needed. However, now I also need to 
know how I can achieve this using the lattice package, since I think I will 
have to make several panels. I've just rephrased the problem and put up another 
post. Hopefully, this will avoid some confusion.

best regards,



________________________________
From: baptiste auguie <baptiste.aug...@googlemail.com>
To: r <r-h...@stat.math.ethz.ch>
Sent: Mon, November 16, 2009 1:31:28 PM
Subject: Re: [R] Discontinuous graph

Hi,

An alternative with ggplot2,

library(ggplot2)

ggplot(data=coords) +
  geom_segment(aes(x=a, xend=b, y=c, yend=c))


HTH,

baptiste

2009/11/16 David Winsemius <dwinsem...@comcast.net>:
>
> 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])
> )
>
> --
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
> ______________________________________________
> 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.
>

______________________________________________
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.



      
        [[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