[R] Histogram plot spacing

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Jan 15 18:20:37 CET 2013



On 15.01.2013 12:35, Julie Collet wrote:
> Dear all,
>
> I'd like to remove the space between the x-axis and the 0 of the y-axis in the hist function.
> I saw the previous post https://stat.ethz.ch/pipermail/r-help/2012-September/324177.html suggesting adding the x-axis at position 0 (or the lowest value of y) after making the histogram. Unfortunately, it doesn't work in my case as I want to use it with a histogram with a ylim starting above 0, so that the x-axis ends up superposing the histogram bars. Any suggestion?
>
> For info, I've been using:
> hist(univariateCV$varcomp, ylim=c(10300,11100), xlim=c(-0.002,0.40), breaks=seq(0,1,0.004), axes=FALSE, main="", ylab="", xlab="",col='blue', xaxt="n")
> axis(1, at=seq(0,0.40,0.05), labels=seq(0,0.40,0.05), pos=10300)
> which gives the x axis superposed with the histogram bars.


par(yaxs="i")
hist(rnorm(100))

Uwe Ligges



> Many thanks
> Julie
>
> 	[[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