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

Marc Schwartz MSchwartz at medanalytics.com
Tue Mar 25 19:54:47 CET 2003


Phillip J. Allen wrote:
> Hi all,
> 
> 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?
> 
> Thanks for any help.
> 
> Phillip J. Allen
> Consulting Geochemist/Geologist
> Lima Peru
> e-mail: paallen at attglobal.net


Phillip,

How about this, which will generate a vertical barplot, a y axis from 0 
down to 40 meters and bar widths and colors for each segment varied:

from <- c(0, 1.2, 4.0, 4.2, 5.0, 25.0, 30.1)
to <- c(1.2, 4.0, 4.2, 5.0, 25, 30.1, 36.2)
intensity <- c(0, 1, 3, 2, 1, 0, 2)
barplot(intensity, width = -(to - from),
         space = 0, horiz = TRUE, ylim = c(-40, 0))
axis(2, las = 2, labels = c(40, 30, 20, 10, 0))
mtext(side = 2, text = "Hole Depth (m)", line = 3)


Hope that helps,

Marc Schwartz



More information about the R-help mailing list