[R] ylim problem in barplot

Robert Baer rbaer at atsu.edu
Thu Jan 5 19:21:20 CET 2006


>     PaulB> When I use barplot but select a ylim value greater
>     PaulB> than zero, the graph is distorted.  The bars extend
>     PaulB> below the bottom of the graph.
>     PaulB> For instance the command produces a problematic graph.
>     PaulB> barplot(c(200,300,250,350),ylim=c(150,400))

> Well, my question would be if that is not a feature :-)
> Many people would consider barplots that do not start at 0 as
>  "Cheating with Graphics"  (in the vein of "Lying with Statistics").

Well, consider this example:
barplot(c(-200,300,-250,350),ylim=c(-99,400))

It seems that barplot uses ylim and pretty to decide things about the axis
but does some slightly unexpected things with the bars themselves that are
not just at the 'zero' end of the bar.

Rob

____________________________
Robert W. Baer, Ph.D.
Associate Professor
Department of Physiology
A. T. Still University of Health Science
800 W. Jefferson St.
Kirksville, MO 63501-1497 USA




More information about the R-help mailing list