[R] barplot2, gap.barplot

Jim Lemon jim at bitwrit.com.au
Fri Mar 2 12:39:35 CET 2007


Marc A. Rohling wrote:
> Hello,
> 
> I try to handle a simple bar-plot, but it turns out to be not as simple
> as I thought.
...
> As you can see, because of the 4th bar (value > 45), the other bars look
> a little bit tiny: there is too much white-space. What I need to handle
> this problem is a function to insert a gap.
> 
> I tried to use gap.barplot, but unfortunately, it cannot handle any of
> the parameters I need from the barplot2-function.
> 
> After days of missing effort, I am sick of this problem. Is there a
> solution?

Hi Marc1,
As Marc2 said, the use of discontinuous axes in plots is a contentious 
one. No, I did not try to make gap.barplot compatible with barplot2 as 
the two seem to have different aims. gap.barplot is one solution to the 
troublesome issue of the outlier. What I would suggest as a one-off 
solution (to the horror of some) is to subtract, say, 25 from the 
outlier value, do the barplot, then:

par(xpd=TRUE)
axis.break(2,21,style="gap")
text(barpos[4],24,48.6)

I realize that your plot is more complex (I don't have gplots, etc. 
installed so I can't reproduce it at the moment), but that might give 
you something with which to work.

Jim



More information about the R-help mailing list