True - gapped stacked bar plots make no sense at all. I'm working my way up to a gapped bar plot with series next to each other (and error bars!), what you'd get if you put a gap in the y-axis of
> twogrp2<-array(twogrp, dim=c(2,5)) > barplot(twogrp2, beside=TRUE) I'm guessing I can do this if I spend enough time with the axis.break() function. But is there an easier way? --Drew > -----Original Message----- > From: Peter Ehlers [mailto:ehl...@ucalgary.ca] > Sent: Monday, April 04, 2011 4:33 PM > To: Andrew D. Steen > Cc: r-help@r-project.org > Subject: Re: [R] gap.barplot doesn't support data arrays? > > On 2011-04-04 06:39, Andrew D. Steen wrote: > > 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="Gr > oup > > 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="G > roup > > 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? > > Looks like they're not supported, as you could easily see from > the code. But do gapped stacked barplots even make sense? Not > to me. > > Still, I think that the plotrix documentation is somewhat > spotty. The help page for gap.barplot indicates that the > input 'y' should be 'data values'; not overly informative. > > Peter Ehlers > > > > > Thanks, > > Drew Steen > > > > ______________________________________________ > > R-help@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. ______________________________________________ R-help@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.