[R] barplot
Jan Malte Wiener
jan.wiener at tuebingen.mpg.de
Tue Jun 25 08:29:19 CEST 2002
Ko-Kang Kevin Wang wrote:
> ----- 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
Well, unfortunately changing ylim does not work properly, try changing
it to ylim= c(30,100) and look at the plot !!!
Also I am using the barplot() function that already exists, I have just
build a function around it (this function calculates and plots also
stderror bars and ....). Now I would like to change the ylim from
outside this function (after calling the function that calls tha R
barplot function)...
greetinx jan
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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