22 function (data = NULL , data.type = " simulations" , style = " fan" , type = " percentile" ,
33 probs = if (type == " percentile" ) seq(0.01 , 0.99 , 0.01 ) else c(0.5 , 0.8 , 0.95 ),
44 start = 1 , frequency = 1 , anchor = NULL , anchor.time = NULL ,
5- fan.col = heat.colors , alpha = if (style == " spaghetti" ) 0.5 else 1 ,
5+ fan.col = grDevices :: heat.colors , alpha = if (style == " spaghetti" ) 0.5 else 1 ,
66 n.fan = NULL ,
77 ln = if (length(probs )< 10 ) probs else
88 probs [round(probs ,2 ) %in% round(seq(0.1 , 0.9 , 0.1 ),2 )],
3131 # #
3232 # #data classes
3333 # #
34- if (is(data , " mts" )[1 ]){
34+ if (methods :: is(data , " mts" )[1 ]){
3535 start <- start(data )[1 ]
3636 frequency <- frequency(data )
3737 }
5959 # work out quantiles
6060 if (data.type == " simulations" ){
6161 pp <- as.matrix(data )
62- pp <- apply(pp ,2 ,quantile ,probs = p )
62+ pp <- apply(pp ,2 ,stats :: quantile ,probs = p )
6363 }
6464 if (data.type == " values" ){
6565 pp <- as.matrix(data )
@@ -86,18 +86,18 @@ fan <-
8686
8787
8888 # ts info
89- if (! is(data , " zoo" )[1 ]){
90- ppts <- ts(pp , start = start , frequency = frequency )
91- tt <- time(ppts )
89+ if (! methods :: is(data , " zoo" )[1 ]){
90+ ppts <- stats :: ts(pp , start = start , frequency = frequency )
91+ tt <- stats :: time(ppts )
9292 tt <- as.numeric(tt )
9393 if (! is.null(anchor )){
94- ppts <- ts(pp , start = time(lag(ppts ))[1 ], frequency = frequency )
95- tt <- time(ppts )
94+ ppts <- stats :: ts(pp , start = stats :: time(stats :: lag(ppts ))[1 ], frequency = frequency )
95+ tt <- stats :: time(ppts )
9696 tt <- as.numeric(tt )
9797 }
9898 }
99- if (is(data , " zoo" )[1 ]){
100- tt <- time(data )
99+ if (methods :: is(data , " zoo" )[1 ]){
100+ tt <- stats :: time(data )
101101 if (! is.null(anchor ))
102102 tt <- c(anchor.time ,tt )
103103 }
@@ -112,7 +112,7 @@ fan <-
112112 fan.col <- fan.col(floor(n / 2 ))
113113 if (! is.null(n.fan ))
114114 fan.col <- fan.col(n.fan )
115- fan.col <- adjustcolor(fan.col ,alpha.f = alpha )
115+ fan.col <- grDevices :: adjustcolor(fan.col ,alpha.f = alpha )
116116 if (is.null(ln.col ))
117117 ln.col <- fan.col [1 ]
118118 }
@@ -124,7 +124,7 @@ fan <-
124124 fan.fill <- function (ts1 , ts2 , tt , fan.col = " grey" ){
125125 xx <- cbind(tt ,rev(tt ))
126126 yy <- cbind(as.vector(ts1 ),rev(as.vector(ts2 )))
127- polygon(xx ,yy , col = fan.col , border = fan.col )
127+ graphics :: polygon(x = xx , y = yy , col = fan.col , border = fan.col )
128128 }
129129 # plot(cpi, type = "l", xlim = c(y0-5, y0+3), ylim = c(-2, 7))
130130 # plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
@@ -142,7 +142,7 @@ fan <-
142142 x <- pp [,1 ]
143143 for (i in 1 : nrow(pp )){
144144 for (j in 1 : floor(n / 2 )){
145- rect(xleft = tt [i ]- 0.5 * space , ybottom = pp [i ,j ], xright = tt [i ]+ 0.5 * space , ytop = pp [i ,n - j + 1 ], col = fan.col [floor(n / 2 )+ 1 - j ], border = fan.col [floor(n / 2 )+ 1 - j ])
145+ graphics :: rect(xleft = tt [i ]- 0.5 * space , ybottom = pp [i ,j ], xright = tt [i ]+ 0.5 * space , ytop = pp [i ,n - j + 1 ], col = fan.col [floor(n / 2 )+ 1 - j ], border = fan.col [floor(n / 2 )+ 1 - j ])
146146 }
147147 }
148148 }
@@ -169,12 +169,12 @@ fan <-
169169 # plot lines
170170 if (style == " fan" ){
171171 for (i in match(ln0 , p ))
172- lines(x = tt , y = pp [,i ], col = ln.col )
172+ graphics :: lines(x = tt , y = pp [,i ], col = ln.col )
173173 }
174174 if (style == " boxfan" ){
175175 for (i in 1 : nrow(pp )){
176176 for (j in match(ln0 , p )){
177- lines(x = tt [i ]+ c(- 0.5 ,0.5 )* space , y = rep(pp [i ,j ],2 ), col = ln.col )
177+ graphics :: lines(x = tt [i ]+ c(- 0.5 ,0.5 )* space , y = rep(pp [i ,j ],2 ), col = ln.col )
178178 }
179179 }
180180 }
@@ -202,9 +202,9 @@ fan <-
202202 rlab <- round(rlab , 5 )
203203 for (i in match(rlab , p )){
204204 if (style == " fan" )
205- text(tt [length(tt )], pp [nrow(pp ),i ], colnames(pp )[i ], pos = rpos , offset = roffset , cex = rcex , col = rcol )
205+ graphics :: text(tt [length(tt )], pp [nrow(pp ),i ], colnames(pp )[i ], pos = rpos , offset = roffset , cex = rcex , col = rcol )
206206 if (style == " boxfan" )
207- text(tt [length(tt )]+ 0.5 * space , pp [nrow(pp ),i ], colnames(pp )[i ], pos = rpos , offset = roffset , cex = rcex , col = rcol )
207+ graphics :: text(tt [length(tt )]+ 0.5 * space , pp [nrow(pp ),i ], colnames(pp )[i ], pos = rpos , offset = roffset , cex = rcex , col = rcol )
208208 }
209209 if (is.na(sum(match(rlab ,p ))))
210210 print(" some right labels not plotted as conflict with precentiles given in probs" )
@@ -224,9 +224,9 @@ fan <-
224224 llab <- rlab
225225 for (i in match(llab , p )){
226226 if (style == " fan" )
227- text(tt [1 ], pp [1 ,i ], colnames(pp )[i ], pos = lpos , offset = loffset , cex = lcex , col = lcol )
227+ graphics :: text(tt [1 ], pp [1 ,i ], colnames(pp )[i ], pos = lpos , offset = loffset , cex = lcex , col = lcol )
228228 if (style == " boxfan" )
229- text(tt [1 ]- 0.5 * space , pp [1 ,i ], colnames(pp )[i ], pos = lpos , offset = loffset , cex = lcex , col = lcol )
229+ graphics :: text(tt [1 ]- 0.5 * space , pp [1 ,i ], colnames(pp )[i ], pos = lpos , offset = loffset , cex = lcex , col = lcol )
230230 }
231231 if (is.na(sum(match(llab ,p ))))
232232 print(" some left labels not plotted as conflict with precentiles given in probs" )
@@ -237,28 +237,28 @@ fan <-
237237 if (style == " fan" | style == " boxfan" ){
238238 if (med.ln == TRUE & data.type == " simulations" ){
239239 pp <- data
240- pm <- apply(pp ,2 ,median )
240+ pm <- apply(pp ,2 ,stats :: median )
241241 if (! is.null(anchor ))
242242 pm <- c(anchor ,pm )
243243 if (is.null(med.col ))
244244 med.col <- ln.col
245245 if (style == " fan" ){
246- lines(x = tt , y = pm , col = med.col )
246+ graphics :: lines(x = tt , y = pm , col = med.col )
247247 }
248248 if (style == " boxfan" ){
249249 for (i in 1 : nrow(pp )){
250250 # lines(x=(i-1)/frequency+c(-0.5,0.5)*space, y=rep(pm[i],2), col=med.col)
251- lines(x = tt [i ]+ c(- 0.5 ,0.5 )* space , y = rep(pm [i ],2 ), col = med.col )
251+ graphics :: lines(x = tt [i ]+ c(- 0.5 ,0.5 )* space , y = rep(pm [i ],2 ), col = med.col )
252252 }
253253 }
254254 if (! is.null(rlab ) & style %in% c(" fan" ," spaghetti" ))
255- text(tt [length(tt )], pm [length(pm )], medlab , pos = rpos , offset = roffset , cex = rcex , col = rcol )
255+ graphics :: text(tt [length(tt )], pm [length(pm )], medlab , pos = rpos , offset = roffset , cex = rcex , col = rcol )
256256 if (! is.null(rlab ) & style == " boxfan" )
257- text(tt [length(tt )]+ 0.5 * space , pm [length(pm )], medlab , pos = rpos , offset = roffset , cex = rcex , col = rcol )
257+ graphics :: text(tt [length(tt )]+ 0.5 * space , pm [length(pm )], medlab , pos = rpos , offset = roffset , cex = rcex , col = rcol )
258258 if (any(llab == TRUE ,is.numeric(llab )) & style %in% c(" fan" ," spaghetti" ))
259- text(tt [1 ], pm [1 ], medlab , pos = lpos , offset = loffset , cex = lcex , col = lcol )
259+ graphics :: text(tt [1 ], pm [1 ], medlab , pos = lpos , offset = loffset , cex = lcex , col = lcol )
260260 if (any(llab == TRUE ,is.numeric(llab )) & style == " boxfan" )
261- text(tt [1 ]- 0.5 * space , pm [1 ], medlab , pos = lpos , offset = loffset , cex = lcex , col = lcol )
261+ graphics :: text(tt [1 ]- 0.5 * space , pm [1 ], medlab , pos = lpos , offset = loffset , cex = lcex , col = lcol )
262262 }
263263 }
264264
@@ -272,9 +272,9 @@ fan <-
272272 # add ancohor
273273 if (! is.null(anchor ))
274274 ps <- cbind(rep(anchor ,nrow(ps )),ps )
275- spag.col <- adjustcolor(ln.col ,alpha.f = alpha )
275+ spag.col <- grDevices :: adjustcolor(ln.col ,alpha.f = alpha )
276276 for (i in 1 : nrow(ps ))
277- lines(x = tt , y = ps [i ,], col = spag.col )
277+ graphics :: lines(x = tt , y = ps [i ,], col = spag.col )
278278 }
279279
280280 # #
@@ -288,12 +288,12 @@ fan <-
288288 if (! is.null(anchor ))
289289 print(" anchor ignored for boxplots plots" )
290290 # single time series to use for at=time
291- p <- ts(pp [1 ,], start = start , frequency = frequency )
291+ p <- stats :: ts(pp [1 ,], start = start , frequency = frequency )
292292 # plot(NULL, type = "n", xlim = c(1, 10), ylim = range(pp), ylab = "Theta")
293293 for (i in 1 : n )
294- boxplot(pp [,i ], add = TRUE , at = time(p )[i ], boxwex = space , xaxt = " n" , yaxt = " n" ,... )
294+ graphics :: boxplot(pp [,i ], add = TRUE , at = stats :: time(p )[i ], boxwex = space , xaxt = " n" , yaxt = " n" ,... )
295295 }
296- box()
296+ graphics :: box()
297297 }
298298
299299
0 commit comments