[R] barplot y axis too short
David Winsemius
dwinsemius at comcast.net
Tue Feb 2 01:48:51 CET 2010
On Feb 1, 2010, at 7:11 PM, Jack Siegrist wrote:
>
> Hello,
>
> The function barplot automatically creates a y-axis that doesn't
> necessarily
> cover the range of y-values to be plotted. I know how to manually
> create my
> own y-axis so that it does cover the range, but I was wondering if
> there is
> some parameter to change so that the scale of the y-axis is
> automatically
> taller than the tallest bar.
>
> I thought setting xpd=F would do it, since it says that xpd determines
> whether bars will be plotted outside of the plotting region, but it
> had no
> effect, so I guess it must be dealing with something different.
>
> In the example below, the scale goes to 15 but the second bar goes
> to 16. In
> this case I would like the scale to go to 20.
>
> Thanks
>
> #example data
> data <- c(12, 16)
>
> #none of the following are any different
> barplot(data)
> barplot(data, xpd=T)
> barplot(data, xpd=F)
barplot(data, xpd=F, yaxp=c(0,max(data), 4) )
> --
> View this message in context: http://n4.nabble.com/barplot-y-axis-too-short-tp1459406p1459406.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list