[R] plotting segments only and in color

Johannes Radinger JRadinger at gmx.at
Mon Aug 15 18:01:27 CEST 2011


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 interval like:
plot(X,Y)

afterwards I can create lines for the interval with:
segments(Xa,Y,Xb,Y)

I think that explains roughly what I'd like to do.

Now some questions:

1) How can I display the segments only? without the points?

2) I'd like only to have points where the range (Xa-Xb) = 0, because
otherwise nothing would be displayed in such cases.

3) How can I color (grey scale) the interval-segments according to their range?
Lets say the wider the range (Xa-Xb) the brighter (the more white)and the narrower the darker (more black)?

4) Is there a special R-package or function besides for plotting interval, or ranging data?

Thanks

/johannes



--



More information about the R-help mailing list