I need a reasonably smart algorithm to come up with \"nice\" grid lines for a graph (chart).
For example, assume a bar chart with values of 10, 30, 72 and 60. You k
In R, use
tickSize <- function(range,minCount){ logMaxTick <- log10(range/minCount) exponent <- floor(logMaxTick) mantissa <- 10^(logMaxTick-exponent) af <- c(1,2,5) # allowed factors mantissa <- af[findInterval(mantissa,af)] return(mantissa*10^exponent) }
where range argument is max-min of domain.