Skip to content

barplot with varaible-width bars

2 messages · Gould, A. Lawrence, Bill Pikounis

#
Hi Larry,
If I understand correctly, your barplot() call dispatches to the
method function barplot.default()  to do the work. Looking at the
definition of that function and your specific call, it seems that
around line 51 of barplot.default(),  the value of the width argument
is truncated:

width <- rep(width, length.out = NR)

where NR <- nrow(height)  is defined a bit earlier around line 44. So
in the execution width takes on the value

[1] 417 153

which seems to explain the same width pieces across pairs.

Just quick and dirty I copied the function barplot.default in the
workspace to an editor, renamed it as mod.barplot.default() and then
commented out line 51 and added the line there: width <- width which
seems at though it could actually be left out as long as beside=TRUE
is kept in the call. Then I created mod.barplot.default() as a working
function, and this call

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

looks like it might provide what you wanted.

Hope that helps.

Bill


-------------------------
Bill Pikounis
http://billpikounis.net/
On Tue, Jan 25, 2011 at 10:47, Gould, A. Lawrence <larry_gould at merck.com> wrote: