[R] Bar plot with variable width (down a drill hole)?

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Tue Mar 25 19:01:05 CET 2003


On 25-Mar-03 Phillip J. Allen wrote:
> I am trying to make a bar plot of  observations along a line or 
> specifically a drill hole with the bars widths representing the
> interval of the observation and the length of the bar the actual
> data.  My data is in the following format:
> 
> from(m)        to(m)        Intensity of silicification
> 0              1.2            0
> 1.2            4.0            1
> 4.0            4.2            3
> 4.2            5.0            2
> 5.0            25             1
> 25.0           30.1           0
> 30.1           36.2           2
> ......
> 
> 
> Is the barplot() function what I really want to use?

It looks as though it should do: see in particular the
arguments height, width, and space, to the function
as described in help(barplot).

For example:
x0<-c(0, 1.2, 4.0, 4.2, 5.0, 25.0, 30.1)
x1<-c(1.2, 4.0, 4.2, 5.0, 25.0, 30.1, 36.2)
y<-c(0, 1, 3, 2, 1, 0, 2)
w<-x1-x0
y[y==0]<-0.001
barplot(height=y,width=w,space=0)

(the extra 0.001 gives a thickened baseline where y=0, to
avoid the impression that there is no bar at such points)

Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 25-Mar-03                                       Time: 18:01:05
------------------------------ XFMail ------------------------------



More information about the R-help mailing list