Hello, I had a question about how to label a axis of a plot. for example, my plot is>plot(1:100, axes=F) >box() >axis(1)then, I want my y-axis has six ticks ( at=seq(0,100,10)) , but I don't want to label all the 11 ticks, I only want to label the 1st, 3rd, 5th, 7th and 11th ticks. But the code axis(), always need the length of the "labels" and "at" be equal, and not allow label partially. Could anyone help me? Thank you! Yan [[alternative HTML version deleted]]
You have almost achieved your goal. plot(1:100, axes=F) axis(1,at=seq(0,100,10)[c(1,3,5,7,11)]) ----- A R learner. -- View this message in context: http://r.789695.n4.nabble.com/ticks-label-of-plot-tp2314226p2314294.html Sent from the R help mailing list archive at Nabble.com.
On 08/05/2010 07:14 AM, yan liu wrote:> Hello, > > I had a question about how to label a axis of a plot. > > for example, my plot is > >> plot(1:100, axes=F) >> box() >> axis(1) > > then, I want my y-axis has six ticks ( at=seq(0,100,10)) , but I don't want > to label all the 11 ticks, I only want to label the 1st, 3rd, 5th, 7th and > 11th ticks. But the code axis(), always need the length of the "labels" and > "at" be equal, and not allow label partially. >Hi Yan, I think you mean that you want to label 6 of the 11 ticks. Try this: axis(1,at=seq(0,100,10), labels=c("1","","3","","5","","7","","9","","11")) Sneakiness is its own reward. Jim