@@ -169,8 +169,8 @@ north <- function(xy=NULL, type=1, label="N", angle=0, d, head=0.1, xpd=TRUE, ..
169169}
170170
171171draw_box <- function (xy , d , below , labels , box.col , cex = 1 , ... ){
172- h <- strheight(" A" , cex = cex )
173- w <- c(strwidth(labels [1 ], cex = cex ), strwidth(labels [length(labels )], cex = cex ))
172+ h <- graphics :: strheight(" A" , cex = cex )
173+ w <- c(graphics :: strwidth(labels [1 ], cex = cex ), graphics :: strwidth(labels [length(labels )], cex = cex ))
174174 box.col <- rep(box.col , length.out = 2 )
175175 b <- ifelse(isTRUE(nchar(below ) > 1 ), 3.5 , 1.5 )
176176 e <- c(xy [1 ]- 1.5 * w [1 ], xy [1 ]+ d + w [2 ], xy [2 ]- b * h , xy [2 ]+ 3 * h )
@@ -191,6 +191,7 @@ sbar <- function(d, xy=NULL, type="line", divs=2, below="", lonlat=NULL, labels,
191191
192192box = FALSE
193193box.col = c(" white" , " black" )
194+ box.adj = c(0 ,0 ,0 ,0 )
194195
195196 stopifnot(type %in% c(" line" , " bar" ))
196197 pr <- graphics :: par()
@@ -248,14 +249,12 @@ box.col=c("white", "black")
248249 lines(rbind(c(xtick [i ], xy [2 ]), c(xtick [i ], xy [2 ]+ tadd )), lwd = ceiling(lwd / 2 ), xpd = TRUE , ... )
249250 }
250251 }
251- tadd <- max(strheight(" 0" , cex = 1 )/ 5 , tadd )
252+ tadd <- max(graphics :: strheight(" 0" , cex = 1 )/ 5 , tadd )
252253 if (length(labels ) == 1 ) labels = c(" " , labels , " " )
253254 add_text(xy [1 ]+ c(0 ,dd / 2 ,dd ),xy [2 ]+ tadd , labels = labels , xpd = xpd , adj = adj , halo = halo , col = col , ... )
254255
255256 } else if (type == " bar" ) {
256257 stopifnot(divs > 0 )
257-
258-
259258 if (missing(adj )) {
260259 adj <- c(0.5 , - 1 )
261260 }
@@ -268,6 +267,11 @@ box.col=c("white", "black")
268267 if (box ) draw_box(xy , dd , below , labels , box.col , ... )
269268
270269 half <- xy [1 ] + dd / 2
270+ if (halo ) {
271+ graphics :: polygon(c(xy [1 ], xy [1 ], xy [1 ]+ dd , xy [1 ]+ dd ),
272+ c(xy [2 ], xy [2 ]+ lwd , xy [2 ]+ lwd , xy [2 ]), col = " white" , xpd = xpd , border = " white" , lwd = 3 )
273+ }
274+
271275 graphics :: polygon(c(xy [1 ], xy [1 ], half , half ), c(xy [2 ], xy [2 ]+ lwd , xy [2 ]+ lwd , xy [2 ]), col = fill [1 ], xpd = xpd , border = border )
272276 graphics :: polygon(c(half , half , xy [1 ]+ dd , xy [1 ]+ dd ), c(xy [2 ], xy [2 ]+ lwd , xy [2 ]+ lwd , xy [2 ]), col = fill [2 ], xpd = xpd , border = border )
273277
@@ -297,9 +301,9 @@ box.col=c("white", "black")
297301 if (below != " " ) {
298302 adj [2 ] <- - adj [2 ]
299303 if (type == " line" ) {
300- xy [2 ] <- xy [2 ] - strheight(" 1" )/ 1.5
304+ xy [2 ] <- xy [2 ] - graphics :: strheight(" 1" )/ 1.5
301305 } else {
302- xy [2 ] <- xy [2 ] - strheight(" 1" )/ 4
306+ xy [2 ] <- xy [2 ] - graphics :: strheight(" 1" )/ 4
303307 }
304308 add_text(xy [1 ]+ (dd / 2 ), xy [2 ], xpd = xpd , labels = below , adj = adj , halo = halo , col = col , ... )
305309 }
0 commit comments