[R] gap.barplot doesn't support data arrays?

From: Andrew D. Steen <andrew.decker.steen_at_gmail.com>
Date: Mon, 04 Apr 2011 15:39:34 +0200

I am trying to make a barplot with a broken axis using gap.barplot (in the indispensable plotrix package). This works well when the data is a vector:

> twogrp<-c(rnorm(10)+4,rnorm(10)+20)
> gap.barplot(twogrp,gap=c(8,16),xlab="Index",ytics=c(3,6,17,20),ylab="Group
values",main="Barplot with gap")

But when the data is an array (for a bar plot with multiple series) I get an error and a strange plot with no y-tics and bars stretching downwards, as if all the values were negative:

> twogrp2<-array(twogrp, dim=c(2,5))

gap.barplot(twogrp2,gap=c(8,16),xlab="Index",ytics=c(3,6,17,20),ylab="Group values",main="Barplot with gap")

Error in rect(xtics[bigones] - halfwidth, botgap, xtics[bigones] + halfwidth, :
  cannot mix zero-length and non-zero-length coordinates

However, the main title and axis labels do appear correctly.

Are data arrays unsupported for gap.barplot, or am I missing something?

Drew Steen

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 04 Apr 2011 - 13:59:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Apr 2011 - 11:20:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive