[R] barplot

Ko-Kang Kevin Wang Ko-Kang at xtra.co.nz
Mon Jun 24 22:56:51 CEST 2002


----- Original Message -----
From: <alexander.schnee at tuebingen.mpg.de>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, June 25, 2002 1:33 AM
Subject: [R] barplot


> Hi,
> a couple of simple graphics questions:
>
> 1. I have a little function that makes bar plots. Now I would like to
> limit the Y-axis outside this
> function (that means after calling the barplot() command) depending on
> the data to be plotted .
> Does anyone know how to do this ???

Perhaps try the barplot() function that already exist in R?

It already allows you to set the axis limt (ylim and xlim).

> 2. When using barplot() and limiting the yAxis, R draws the bars below
> the x-axis. How can I avoid this problem ??

Again, it shouldn't happen.  The codes below are directly extracted from the
barplot() documentation:

data(VADeaths, package = "base")
hh <- t(VADeaths)[, 5:1]
mybarcol <- "gray20"
mp <- barplot(hh, beside = TRUE,
              col = c("lightblue", "mistyrose",
                "lightcyan", "lavender"),
              legend = colnames(VADeaths), ylim= c(0,100),
              main = "Death Rates in Virginia", font.main = 4,
              sub = "Faked upper 2*sigma error bars", col.sub = mybarcol,
              cex.names = 1.5)

It works.  Try changing the "ylim = c(0, 100)" to other limits, it still
works!

Cheers,

Ko-Kang Wang


------------------------------------------------
Ko-Kang Kevin Wang
Post Graduate PGDipSci Student
Department of Statistics
University of Auckland
New Zealand

www.stat.auckand.ac.nz/~kwan022


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list