Hi, I want 12 ticks at axis 1 and want to write Jan-Dec on each. something like: axis(1, at=1:12, labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) I could omit default ticks but now how to control ticks. plot(file$time, file$ch4*1000, ylim=c(1500,1700), xaxt='n', xlab= NA, ylab=NA,col="blue",yaxs="i",lwd=2, pch=10, type="b")# axis(1, at=1:12, labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) BUT above is not working, and there is no error as well. Pls help, Regards, Yogesh [[alternative HTML version deleted]]
Hi, The following seems to work: plot(1:12,1:12,xaxt='n',xlab=NA) axis(1,at=1:12,labels=c("J","F","M","A","M","J","J","A","S","O","N","D") ) So I'd guess that your X axis data, file$time, doesn't take the values 1 to 12. Martyn -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Yogesh Tiwari Sent: 21 December 2010 12:37 To: r-help Subject: [R] how to control ticks Hi, I want 12 ticks at axis 1 and want to write Jan-Dec on each. something like: axis(1, at=1:12, labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) I could omit default ticks but now how to control ticks. plot(file$time, file$ch4*1000, ylim=c(1500,1700), xaxt='n', xlab= NA, ylab=NA,col="blue",yaxs="i",lwd=2, pch=10, type="b")# axis(1, at=1:12, labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) BUT above is not working, and there is no error as well. Pls help, Regards, Yogesh [[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. ________________________________________________________________________ This e-mail has been scanned for all viruses by Star.\ _...{{dropped:12}}
On Tue, 21 Dec 2010 18:06:52 +0530 Yogesh Tiwari <yogesh.mpi at googlemail.com> wrote:> Hi, > I want 12 ticks at axis 1 and want to write Jan-Dec on each. > > something like: > > axis(1, at=1:12, > labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) > > I could omit default ticks but now how to control ticks. >Dear Yogesh, I spray my clothing with "No-Bite", and that controls ticks quite well. :-) Edwin> plot(file$time, file$ch4*1000, ylim=c(1500,1700), xaxt='n', xlab= NA, > ylab=NA,col="blue",yaxs="i",lwd=2, pch=10, type="b")# > > axis(1, at=1:12, > labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) > > BUT above is not working, and there is no error as well. > > Pls help, > > Regards, > Yogesh > > [[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.Dr. Edwin Groot, postdoctoral associate AG Laux Institut fuer Biologie III Schaenzlestr. 1 79104 Freiburg, Deutschland +49 761-2032945
What is the structure of file$time? Is it Date/POSIXct? 'at=1:12' only works if those are the dimensions of file$time. So give us an idea of what the data is (PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code). On Tue, Dec 21, 2010 at 7:36 AM, Yogesh Tiwari <yogesh.mpi at googlemail.com> wrote:> Hi, > I want 12 ticks at axis 1 and want to write Jan-Dec on each. > > something like: > > axis(1, at=1:12, labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) > > I could omit default ticks but now how to control ticks. > > plot(file$time, file$ch4*1000, ylim=c(1500,1700), xaxt='n', xlab= NA, > ylab=NA,col="blue",yaxs="i",lwd=2, pch=10, type="b")# > > axis(1, at=1:12, labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) > > BUT above is not working, and there is no error as well. > > Pls help, > > Regards, > Yogesh > > ? ? ? ?[[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. >-- Jim Holtman Data Munger Guru What is the problem that you are trying to solve?
I'm not sure, but perhaps you want to copy the logic of: http://www.portfolioprobe.com/R/blog/pp.timeplot.R On 21/12/2010 12:36, Yogesh Tiwari wrote:> Hi, > I want 12 ticks at axis 1 and want to write Jan-Dec on each. > > something like: > > axis(1, at=1:12, labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) > > I could omit default ticks but now how to control ticks. > > plot(file$time, file$ch4*1000, ylim=c(1500,1700), xaxt='n', xlab= NA, > ylab=NA,col="blue",yaxs="i",lwd=2, pch=10, type="b")# > > axis(1, at=1:12, labels=c('J','F','M','A','M','J','J','A','S','O','N','D')) > > BUT above is not working, and there is no error as well. > > Pls help, > > Regards, > Yogesh > > [[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. >-- Patrick Burns pburns at pburns.seanet.com twitter: @portfolioprobe http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of 'Some hints for the R beginner' and 'The R Inferno')