[R] ylim problem in barplot
maechler at stat.math.ethz.ch
Fri Jan 6 12:34:38 CET 2006
>>>>> "Ben" == Ben Bolker <bolker at ufl.edu>
>>>>> on Thu, 5 Jan 2006 19:21:48 +0000 (UTC) writes:
Ben> Robert Baer <rbaer <at> atsu.edu> writes:
>> Well, consider this example:
>> 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.
no, there's no pretty() involved.
Maybe it helps you to just type box()
after the plot. Simply, the usual par("mar") margins are set.
I think ___in conclusion___ that Marc Schwartz' solution has been
right on target all along:
>>>> Use 'xpd = FALSE' if you set 'ylim' because otherwise, the
>>>> result may be confusing.
The real "problem" of barplot.default() is the fact that
'xpd = TRUE' is the default, and AFAIK that's not the case
for other high-level plot functions.
One could debate if the default setting for xpd should not be changed to
xpd = (is.null(ylim) && !horiz) || (is.null(xlim) && horiz)
Now this has definitely gotten a topic for R-devel, and not
Ben> in previous cases I think there was room for debate about
Ben> the appropriate behavior. What do you think should happen
Ben> in this case? Cutting off the bars seems like the right thing
Ben> to do;
Ben> is your point that the axis being confined to positive values (a side effect of setting ylim) is weird?
More information about the R-help