# R/a_cb_brackets.R In pBrackets: Plot Brackets

#### Defines functions a_cb_brackets

```a_cb_brackets <-
function(phi=1, ticks=0.5, type=1){
if(phi<0.01) phi <-0.01
n      <- 1000
d_start <- 1
d_end   <- 1
if(!is.null(ticks)){
ticks  <- unique(ticks)
tsigns <- sign(ticks)
o      <- order(abs(ticks))
ticks  <- abs(ticks)[o]
tsigns <- tsigns[o]
if(ticks[1]==0){
d_start<- -1
ticks<- ticks[-1]
tsigns <- tsigns[-1]
}
if(length(ticks)>0){
if(ticks[length(ticks)]==1){
d_end<- -1
ticks  <- ticks[-length(ticks)]
tsigns <- tsigns[-length(tsigns)]
}
}
}
nt     <- length(ticks)
np     <- 2+2*nt
rx     <- (1/np)*phi
md     <- min(diff(c(0, ticks, 1)))
if(md<(rx*2)) rx<- md/2
if(type==1) p <- -rev(exp(seq(0,5,length.out=round(n*rx))))
if(type==2) p <-  sqrt(seq(0,5,length.out=round(n*rx)))
if(type==3) p <- seq(0,1,length.out=round(n*rx))
if(type==4) p <- c(0,rep(1, round(n*rx)-1))
if(type==5) p <- -rev((seq(0,5,length.out=round(n*rx)))^2)
p      <- a_st(p)
pb     <- length(p)
location <- pb
if(nt>0){
for(i in 1:nt){
on <- round(n*ticks[i])
location <- on+pb
}
}
sy <- c(sy, rep(1, n-location-pb), rev(p)*d_end+add_e)
sy <- a_st(sy)
sx <- seq(0, 1, length.out=length(sy))
rbind(sx, sy)
}
```

## Try the pBrackets package in your browser

Any scripts or data that you put into this service are public.

pBrackets documentation built on May 2, 2019, 7:02 a.m.