File: tsxpos.R

package info (click to toggle)
r-cran-plotrix 3.8-4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,588 kB
  • sloc: makefile: 6
file content (16 lines) | stat: -rwxr-xr-x 451 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
tsxpos<-function(x,xlim,nint) {
 # make sure that there is a graphics device open
 if(dev.cur() == 1) stop("A graphics device must be open")
 if(missing(xlim)) {
  plotlim<-par("usr")
  divlim<-ifelse(par("xaxs") == "r",0.04,0)
  xrange<-(plotlim[2]-plotlim[1])/(1+2*divlim)
  xstart<-plotlim[1]+xrange*divlim
 }
 else {
  xstart<-xlim[1]
  xrange<-diff(xlim)
 }
 if(missing(nint)) nint<-length(x)-1
 return(cumsum(c(xstart,rep(xrange/nint,nint))))
}