Thank you. with best regards, Sudheer
On Mon, Aug 26, 2013 at 4:36 AM, Jim Lemon <j...@bitwrit.com.au> wrote: > On 08/26/2013 01:09 AM, Sudheer Joseph wrote: > >> Attached is a plot with a time series. If I have a time series object in >> R. >> How do I get the plot in the attached format of time axis?. When I issue >> plot(ts) I get a time series plot with tic only for years. >> >> >> Hi Sudheer, > If your problem is similar to that answered last week "X axis label as > months", you can follow the suggestion by the other Jim and then add a > custom x axis. The problem is getting the axis labels aligned, and this > function: > > tsxpos<-function(x) { > # make sure that there is a graphics device open > if(dev.cur() == 1) stop("A graphics device must be open") > plotlim<-par("usr") > divlim<-ifelse(par("xaxs") == "r",0.04,0) > xrange<-(plotlim[2]-plotlim[1]**)/(1+2*divlim) > xstart<-plotlim[1]+xrange***divlim > nint<-length(x)-1 > return(cumsum(c(xstart,rep(**xrange/nint,nint)))) > } > > when called after creating the original time series plot will return the x > positions for the time series (the "x" argument is for the time series > object). You can then pass these values to the axis function in the "at" > argument with your desired labels in the "labels" argument. This function > has been added to the plotrix package and will appear in the next version. > > Jim > -- with best regards Sudheer ********************************************************************************** Dr. Sudheer Joseph Scientist INDIAN NATIONAL CENTRE FOR OCEAN INFORMATION SERVICES (INCOIS) MINISTRY OF EARTH SCIENCES, GOVERNMENT OF INDIA "OCEAN VALLEY" PRAGATHI NAGAR (BO) OPP.JNTU, NIZAMPET SO Andhra Pradesh, India. PIN- 500 090. TEl:+91-40-23044600(R),Tel:+91-9440832534(Mobile) Tel:+91-40-23886047(O),Fax:+91-40-23892910(O) E-mail: sudheer.jos...@yahoo.com; s...@incois.gov.in. Web- http://oppamthadathil.tripod.com --------------* --------------- "The ultimate measure of a man is not where he stands in moments of comfort and convenience, but where he stands at times of challenge and controversy." Martin Luther King, Jr. "What we have done for ourselves alone dies with us. What we have done for others and the world remains and is immortal." - Albert Pines [[alternative HTML version deleted]] ______________________________________________ R-help@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.