- segments(x, y, x + length, y)
- text(x + length * 1.1, y, as.character(length), adj = c(0, 0.5), ...)
+ if (missing(x) || missing(y)) {
+ switch(lastPP$direction,
+ "rightwards" = {
+ x <- 0
+ y <- 1
+ segments(x, y, x + length, y)
+ text(x + length * 1.1, y, as.character(length), adj = c(0, 0.5), ...)
+ },
+ "leftwards" = {
+ x <- max(lastPP$xx)
+ y <- 1
+ segments(x - length, y, x, y)
+ text(x - length * 1.1, y, as.character(length), adj = c(1, 0.5), ...)
+ },
+ "upwards" = {
+ x <- max(lastPP$xx)
+ y <- 0
+ segments(x, y, x, y + length)
+ text(x, y + length * 1.1, as.character(length), adj = c(0, 0.5), srt = 90, ...)
+ },
+ "downwards" = {
+ x <- 1
+ y <- max(lastPP$yy)
+ segments(x, y - length, x, y)
+ text(x, y - length * 1.1, as.character(length), adj = c(0, 0.5), srt = 270, ...)
+ }
+ )
+ }