File: feather.plot.R

package info (click to toggle)
r-cran-plotrix 3.2-6-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,136 kB
  • sloc: makefile: 3
file content (23 lines) | stat: -rwxr-xr-x 727 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
feather.plot<-function(r,theta,xpos,yref=0,use.arrows=TRUE,
 col.refline="lightgray",fp.type="s",main="",xlab="",ylab="",
 xlabels=NULL,...) {

 if(missing(xpos)) xpos<-1:length(theta)
 # reverse the angles and start at 12 o'clock
 if(fp.type == "m") theta<-5*pi/2-theta
 x<-r*cos(theta)
 y<-r*sin(theta)
 xlim<-range(c(xpos,x+xpos))
 ylim<-range(c(y,yref))
 oldpin<-par("pin")
 xdiff<-xlim[2]-xlim[1]
 ydiff<-ylim[2]-ylim[1]
 plot(0,xlim=xlim,ylim=ylim,type="n",main=main,xlab=xlab,ylab=ylab,axes=FALSE)
 box()
 if(is.null(xlabels)) axis(1)
 else axis(1,at=xpos,labels=xlabels)
 abline(h=yref,col=col.refline)
 if(use.arrows) arrows(xpos,yref,xpos+x,y,length=0.1,...)
 else segments(xpos,yref,xpos+x,y,...)
 par(pin=oldpin)
}