0

is there a way to increase the y axis length to the maximun value? When I use this code:

 par(mfrow=c(3,5))
 for (i in c("mrts","p100e10","p75","PIA","pop1076","pop1616","pop2911","pop500","pop800","rev84","SugarCaneFarms","Swiss","USbanks","UScities","UScolleges"))
 {
   boxplot(dados[[i]],xlab=i)
 }

But then it appears boxplots with a low y axis. I need to change the y axis but I didnt want to change one by one, I want to appear the last value.

Boxplots

How Can I do that? If it is not possible, how can I do it one by one? Thanks

T. Veiga
  • 191
  • 2
  • 10
  • Please include all data and code necessary to reproduce your problem. Hover your pointer over the `r` tag for more info. – Hack-R Nov 13 '16 at 23:14

2 Answers2

2

You can specify ylim with the minimal and maximal values of the y axis. In your example:

boxplot(dados[[i]],xlab=i,ylim=c(min(dados[[i]]),max(dados[[i]])))
santoraa
  • 36
  • 3
  • Thank you for your ansewr. But it still didnt do what I wanted. I wanted a way to change the names in the Y vector, so that it showed the maximun one. Just the format. – T. Veiga Nov 15 '16 at 12:00
  • If I get it right you want to change the breakpoints of the y axis so that the highest value be exactly the maximum. `boxplot(dados[[i]],xlab=i,yaxt="n" – santoraa Nov 15 '16 at 13:19
  • ) and `axis(side=2,at=c(min(dados[i]),max(dados[i])))` If you want _n_ breakpoints just change c(min,max) to seq(min,max,length.out=_n_) – santoraa Nov 15 '16 at 13:26
0
ylim=c(-min,max)

It's a corollary of xlim and should solve your issue.

oliver
  • 2,467
  • 3
  • 14
  • 29