[R] Tick intervals

Jim Lemon jim at bitwrit.com.au
Thu Sep 13 12:07:06 CEST 2007


livia wrote:
> Hi, I would like to plot a histogram with the following codes, and I would
> like to make the tick intervals smaller. I tried to add "lab=c(1,1,12)", but
> nothing changes.
> 
> 
> par(mfrow=c(1,1),font=1, cex=0.8)
> hist (data1, seq(-0.01,0.3,0.01),freq = FALSE,
> main="Figure1.",xlab="return",lab=c(1,1,12))
> lines(density(data1), col="blue")
> 
Hi Livia,
 From the look of your example, I suspect you may want more labels for 
the 31 bars of your histogram. The following will give you many more 
labels that don't overlap:

library(plotrix)
hist (data1, seq(-0.01,0.3,0.01),freq = FALSE,
main="Figure1.",xlab="return",lab=c(1,1,12),xaxt="n")
staxlab(1,at=seq(-0.01,0.3,by=0.02),labels=seq(-0.01,0.3,by=0.02))

Jim



More information about the R-help mailing list