[R] breaking the x-axis and having two different x-axis labels
jim at bitwrit.com.au
Thu Aug 30 13:50:09 CEST 2007
Georg Ehret wrote:
> Dear R community,
> I have two questions concerning barplots that I struggle to resolve:
> 1) How can I break (interrupt) the x-axis (e.g.: have it display values from
> -100 to -90 and 90 to 100 only)?
I think you mean a horizontal barplot with a gap between -90 and 90.
pyramid.plot (plotrix) doesn't quite do what you want, as the present
version doesn't allow customized axis labels. The principle is the same
as that used in gap.barplot, but the maintainer (me) didn't think that
anyone would want to do this horizontally. If you are stuck I can add a
feature or two...
However, here's an unbeauteous hack.
> 2) I overlay two horizontal barplots: one with negative values only and one
> with positive values only: I would wish to mark the two datasets separately
> on the x-axis (or some other way). If I use the legend I get a superposed
> result... is there another way?
This sounds like a job for "axis", but I can't really picture what you
describe. Do you want the negative bars starting from the right and
going left and the positive ones starting from the left and going right?
Or a vertical line in the center with the bars going in the usual
More information about the R-help