add scale_from to spec tools
diff --git a/R/spec_tools.R b/R/spec_tools.R
index f62f9e3..47e51d1 100644
--- a/R/spec_tools.R
+++ b/R/spec_tools.R
@@ -3,11 +3,19 @@
 #' @inheritParams viridisLite::viridis
 #' @param x continuous vectors of values
 #' @param na_color color code for NA values
+#' @param scale_from input range (vector of length two). If not given,
+#' is calculated from the range of x
 #' @export
 spec_color <- function(x, alpha = 1, begin = 0, end = 1,
                        direction = 1, option = "D",
-                       na_color = "#BBBBBB") {
-  x <- round(rescale(x, c(1, 256)))
+                       na_color = "#BBBBBB", scale_from = NA) {
+  if (is.na(scale_from)) {
+    x <- round(rescale(x, c(1, 256)))
+  } else {
+    x <- round(rescale(x, to = c(1, 256),
+                       from = scale_from))
+  }
+
   color_code <- viridisLite::viridis(256, alpha, begin, end, direction, option)[x]
   color_code[is.na(color_code)] <- na_color
   return(color_code)
@@ -45,9 +53,17 @@
 #' @param begin Smalles font size to be used. Default is 10.
 #' @param end Largest font size. Default is 20.
 #' @param na_font_size font size for NA values
+#' @param scale_from input range (vector of length two). If not given,
+#' is calculated from the range of x
 #' @export
-spec_font_size <- function(x, begin = 8, end = 16, na_font_size = 12) {
-  x <- round(rescale(x, c(begin, end)))
+spec_font_size <- function(x, begin = 8, end = 16, na_font_size = 12,
+                           scale_from = NA) {
+  if (is.na(scale_from)) {
+    x <- round(rescale(x, c(begin, end)))
+  } else {
+    x <- round(rescale(x, to = c(begin, end),
+                       from = scale_from))
+  }
   x[is.na(x)] <- na_font_size
   return(x)
 }
@@ -57,9 +73,16 @@
 #' @param x continuous vectors of values
 #' @param begin Smallest degree to rotate. Default is 0
 #' @param end Largest degree to rotate. Default is 359.
+#' @param scale_from input range (vector of length two). If not given,
+#' is calculated from the range of x
 #' @export
-spec_angle <- function(x, begin, end) {
-  x <- round(rescale(x, c(begin, end)))
+spec_angle <- function(x, begin, end, scale_from = NA) {
+  if (is.na(scale_from)) {
+    x <- round(rescale(x, c(begin, end)))
+  } else {
+    x <- round(rescale(x, to = c(begin, end),
+                       from = scale_from))
+  }
   x[is.na(x)] <- 0
   return(x)
 }