xlim, ylim problem in barplot (PR#325)

mcw@ln.nimh.nih.gov mcw@ln.nimh.nih.gov
Mon, 15 Nov 1999 22:08:06 +0100 (MET)

Hi, all.

The lower bound in a barplot (or the left bound if you're making a
horizontal barplot) is -0.01 no matter what.  This causes problems if
you're making a barplot of small values (say, < .001), as most of the plot
is taken up with blank space beneath the axis, and the bars are squeezed
in at the top.  The fix seems to be simple: replace lines

41:      xlim <- range(-0.01, height) 
59:      ylim <- range(-0.01, height)

by the following:

41:      xlim <- range(max(-0.01, -0.01 * height), height) 
59:      ylim <- range(max(-0.01, -0.01 * height), height)

This seems to work for small negative numbers as well.

Thanks again for the software.

Matt Wiener

r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch