I would like to produce a bar plot with varying-width bars.  Here is an example to illustrate:

ww <- c(417,153,0.0216,0.0065,556,256,0.0162,0.0117,
+  726,379,0.0358,0.0501,786,502,0.0496,0.0837,
+  892,591,0.0785,0.0795)
yy<-t(t(array(ww,c(2,10))))

barplot(yy[,2*1:5],las=1,space=c(.1,.5),beside=T)

produces a barplot of 5 pairs of bars that are of equal width

barplot(yy[,2*1:5],las=1,width=c(yy[,(2*1:5)-1]),space=c(.1,.5),beside=T)

makes the bars in each pair of unequal width, but the two widths do not vary from pair to pair

I would like the width of each bar to be proportional to its corresponding value in the width statement of this last call of barplot, like what I think could be done with the mulbar function of SPlus.  Can I do this with barplot itself, or is this something for which lattice or ggplot 2 is needed?  And, if so, what would typical code look like?

Thanks for your help.

Larry Gould


Notice:  This e-mail message, together with any attachme...{{dropped:14}}

