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") Could anyone give me sone advice? Many thanks, -- View this message in context: http://www.nabble.com/Tick-intervals-tf4430457.html#a12639110 Sent from the R help mailing list archive at Nabble.com.
Do you just want the tick intervals on the axis to be changed? Or do you want more bars in the histogram itself? If the latter, then look at the breaks argument to hist. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at intermountainmail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of livia > Sent: Wednesday, September 12, 2007 10:25 AM > To: r-help at stat.math.ethz.ch > Subject: [R] Tick intervals > > > 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") > > > Could anyone give me sone advice? > Many thanks, > -- > View this message in context: > http://www.nabble.com/Tick-intervals-tf4430457.html#a12639110 > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >
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