R/maptolwd.R

Defines functions maptolwd

Documented in maptolwd

#' maps numeric vector to line widths
#'
#'
#' @param lwdby numeric vector to map to line widths
#' @param range range of values to map
#' @examples
#' plot((1:10),lwd=maptolwd(lwdby=(1:10)))
maptolwd <-
function(lwdby,range=c(1,5))
{
  lwdby =  lwdby - min(lwdby)
  fractionofmax = lwdby / max(lwdby)
  lwds = round(fractionofmax * abs(range[2] - range[1]),digits = 1) + range[1]
  return(lwds) 
}

Try the Sushi package in your browser

Any scripts or data that you put into this service are public.

Sushi documentation built on Nov. 8, 2020, 7:48 p.m.