[R] How to change the scale of the Y axis?

Pete Brecknock Peter.Brecknock at bp.com
Sat Oct 8 03:04:16 CEST 2011


feargalr wrote:
> 
> I am currently trying to create 3 histograms from 3 sets of data and in
> order to compare them I need them all to have a common scale, the Y axis
> is the only place its a problem, as one histogram only goes up to 4,
> another 5, and another 7 on the Y axis and obviously they all need to be
> in the same scale to allow comparisons. Can anyone help?
> 
> Thanks,
> Feargal
> 


The ylim option in the hist function should do what you need ....

A simple example with 2 sets of data ....

# Create Data
set.seed(123)
d1 = 7*rnorm(100)
d2 = runif(100)

par(mfrow = c(2,1))
hist(d1, ylim=c(0,50))
hist(d2, ylim=c(0,50))

HTH

Pete

--
View this message in context: http://r.789695.n4.nabble.com/How-to-change-the-scale-of-the-Y-axis-tp3883843p3884112.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list