[R] Re: Bar plot with variable width (down a drill hole) - n

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Wed Mar 26 11:41:45 CET 2003


On 26-Mar-03 Ted Harding wrote:
> On 25-Mar-03 Phillip J. Allen wrote:
> However, this kind of situation needs thought about alternative
> ways of representing it.
> 
> One possibility might be to have the vertical axis invisible,
> so that gaps in the data are represented by gaps in the axis
> (and then there would be no need for "adding a bit to true zeros").
> Possibly this can be arranged by some setting of "par", though
> I can't seem to achieve it with barplot. Ideas, anyone?
> (It looks as though "axis" in barplot means the scale which is
> plotted below or on the side, and not the lines which bound the
> barplot itself).

Just had a thought on this front, and it works!

Where there are missing data, give intensity the value "NA", but
fill in the gaps in width as before (and you don't need to "thicken"
true zeros any more -- unless you want to):

from <- c(0, 1.2, 4.0, 4.2, 5.0, 25.0, 30.1, 45)
to <- c(1.2, 4.0, 4.2, 5.0, 25, 30.1, 36.2, 50)
intensity <- c(0, 1, 3, 2, 1, 0, 2, 5)

y<-intensity;
y<-c(y[1:7],NA,y[8])

w<-(-(to - from))
w<-c(w[1:7],-(45-36.2),w[8])

barplot(y, w, space = 0, horiz = TRUE, ylim = c(-50, 0))

Cheers,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 26-Mar-03                                       Time: 10:41:45
------------------------------ XFMail ------------------------------



More information about the R-help mailing list