Skip to content

Commit 0c8b7e5

Browse files
committed
Add rough print method to ScaleContinuous
1 parent d314eb8 commit 0c8b7e5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

R/scale-.r

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,14 @@ ScaleContinuous <- ggproto("ScaleContinuous", Scale,
326326
list(range = range, labels = labels,
327327
major = major_n, minor = minor_n,
328328
major_source = major, minor_source = minor)
329+
},
330+
331+
print = function(self, ...) {
332+
show_range <- function(x) paste0(formatC(x, digits = 3), collapse = " -- ")
333+
334+
cat("<", class(self)[[1]], ">\n", sep = "")
335+
cat(" Range: ", show_range(self$range$range), "\n", sep = "")
336+
cat(" Limits: ", show_range(self$dimension()), "\n", sep = "")
329337
}
330338
)
331339

0 commit comments

Comments
 (0)