Re: [R] plotting segments only and in color

2011-08-16 Thread Eik Vettorazzi
Hi Johannes, plot(X,Y,type="n") creates an empty plot with correct dimensions, ind<-!(Xb==Xa) points(X[ind],Y[ind]) plots points for zero-length intervals only, and gray() can be used for shading lines, as in segments(Xa,Y,Xb,Y,col=gray(.9*(Xb-Xa)/max(Xb-Xa))) #the longest interval will be gray(.9)

Re: [R] plotting segments only and in color

2011-08-15 Thread Dennis Murphy
Hi: Here's one approach using the ggplot2 package: Y=c(15,14,23,18,19,9,19,13) Xa=c(17,22,21,18,19,25,8,19) Xb=c(22,22,29,34,19,26,17,22) dd <- data.frame(Y, Xa, Xb) ggplot(dd) + geom_segment(aes(x = Xa, xend = Xb, y = Y, yend = Y, colour = Xb - Xa), size = 2) + geom_po

[R] plotting segments only and in color

2011-08-15 Thread Johannes Radinger
Hello, I've a question concerning the display of interval data. A sample dataset where X is an interval between Xa and Xb which should be displayed: Y=c(15,14,23,18,19,9,19,13) Xa=c(17,22,21,18,19,25,8,19) Xb=c(22,22,29,34,19,26,17,22) X = (Xa+Xb)/2 It's easily possible to plot the mean of the