Re: [R] draw a graphic using segments to represent data

From: Camarda, Carlo Giovanni <>
Date: Wed 10 May 2006 - 21:01:41 EST

I am not sure whether I completely understood your question. Anyway, here it's a simple code that, hopefully, overcome your problem.

Data=cbind(c(1, 2, -1, 3, -2.2), c(1, 3, -1, -1.8, 4)) plot(x=rep(0,nrow(Data)), Data[,1], axes=F, xlim=c(-max(Data[,2]), max(Data[,2])), xlab="", col=1:nrow(Data), cex=2) axis(2)
for(i in 1:nrow(Data)){

    segments(x0=0, y0=Data[i,1], x1=Data[i,1] + Data[i,2], y1=Data[i,1], col=i)

Carlo Giovani Camarda

Camarda Carlo Giovanni
Max Planck Institute for Demographic Research Konrad-Zuse-Strasse 1
18057 Rostock, Germany
Tel: +49 (0)381 2081 172
Fax: +49 (0)381 2081 472

Date: Tue, 9 May 2006 15:10:37 -0400
From: "Wang, Xuetao" <> Subject: [R] draw a graphic using segments to represent data To:

        <FE0A8E789155874B84394D4C1EED8A8D041A7BDB@CHEXV1.CHBOSTON.ORG> Content-Type: text/plain


I'd like to draw a graphic using different color line segments to represent microarray data. It simply likes this:

Data=cbind(c(1, 2, -1, 3, -2.2), c(1, 3, -1, -1.8, 4))

The first col No represents y'axis position (negative down and positive up). The second col No represents a length of segment (negative segment should be on left of y, and positive on right). Also the segment color on I, II, III, IV should be different.  

Thank you for your time and help.  


This mail has been sent through the MPI for Demographic Rese...{{dropped}} mailing list PLEASE do read the posting guide! Received on Wed May 10 21:05:09 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 10 May 2006 - 22:10:08 EST.

Mailing list information is available at Please read the posting guide before posting to the list.