[R] scaling x-axis in hist function

Henrique Dallazuanna wwwhsd at gmail.com
Fri Nov 9 21:10:05 CET 2007


Try this:

hist(all$PI_HAT, labels=T, main="PI_HAT distribution (All)",
xlab="PI_HAT",ylab="count", col="gray",ylim=c(0,15), axes=F)
axis(2)
axis(1, at=seq(0,1, by=0.1), labels=seq(0,1, by=0.1))

runif generate a sample of Uniform Distribution, see ?runif.

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

On 09/11/2007, Manisha Brahmachary <mb3058 at columbia.edu> wrote:
>
>
>
>
> Hi,
>
>
>
> Thanks for your prompt reply. I tried out the code and it works. Currently my code is  something like this:
>
>
>
> hist(all$PI_HAT, labels=T, main="PI_HAT distribution (All)", xlab="PI_HAT",ylab="count", col="gray",ylim=c(0,15))
>
>
>
> May I ask you, what does runif(50,0,1) mean? How do I intergrate your code with my code written above?
>
>
>
> Thanks a lot!
>
>
>
> manisha
>
>
>
>   ________________________________

>
> From: Henrique Dallazuanna [mailto:wwwhsd at gmail.com]
>  Sent: Friday, November 09, 2007 2:51 PM
>  To: Manisha Brahmachary
>  Cc: r-help at stat.math.ethz.ch
>  Subject: Re: [R] scaling x-axis in hist function
>
>
>
>
> Perhaps you can do:
>
>  x <- runif(50, 0,1)
>  hist(x, axes=F)
>  axis(2)
>  axis(1, at=seq(0,1, by=0.1), labels=seq(0,1, by=0.1))
>
>
>
>
>  --
>  Henrique Dallazuanna
>  Curitiba-Paraná-Brasil
>  25° 25' 40" S 49° 16' 22" O
>
>
> On 09/11/2007, Manisha Brahmachary <mb3058 at columbia.edu> wrote:
>
> Hi,
>
>
>
>  I have a query regarding usage of hist (histogram) function in R.
>
>
>
>  I have a data where the range of the x -axis is from 0.0-1.0. When I use
>  hist the ticks on the x-axis it gives me by default is at
>  0.0,0.2,0.4,0.6,0.8 and 1.0.
>
>  If I want more ticks such that the x-axis has 0.0,0.1,0.2,0.3...till 1.0
>  what parameter should I use in the hist function?
>
>
>
>
>
>  Thanks
>
>  manisha
>
>
>
>
>          [[alternative HTML version deleted]]
>
>  ______________________________________________
>  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.
>
>



More information about the R-help mailing list