[R] Incomplete x-axis in barplots

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Aug 6 18:47:49 CEST 2008


On Wed, 6 Aug 2008, Hanna Granroth wrote:

> Hi everyone,
>
> This is a graphics question, concerning presentation rather than
> actually producing figures.
> After much fiddling I've managed to create bar plots showing error
> bars. I've put in an x-axis, which goes along all the bars, but
> doesn't appear between the y-axis and the first bar. I've searched all
> the resources I have access to but can't find anything addressing this
> issue. Does anyone know how to make the x-axis stretch all the way
> from the y-axis to the end of the right-most bar? It would make my
> picture beautifully complete!

Use abline?  ?axis explicitly tells you

      The axis line is drawn from the lowest to the highest value of
      'at', but will be clipped at the plot region.

Without any code (let alone a reproducible example) we can only guess at 
what you did.

A standard R scatter plot has an x-axis that does not extend to the ends, 
but it overlays a box().  If you only want the bottom line of the box, use 
abline or lines to plot it.

> This is R 2.7.0 running on Windows XP.
>
> Thanks very much,
> Hanna
>
> ______________________________________________
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list