Debian Codegraph @

R/mapasp.R

raw
1 mapasp <- function(data, xlim = bbox(data)[1,], ylim = bbox(data)[2,]) {
2 # calculates aspect ratio for levelplot of geographic data,
3 # using proportial units (compare eqscplot)
4 if (!is(data, "Spatial"))
5 stop("cannot extract coordinates bounding box from data")
6 if (!(is.na(slot(slot(data, "proj4string"), "projargs")) || is.projected(data)))
7 (diff(ylim)/diff(xlim)) / cos((mean(ylim) * pi)/180)
8 else
9 diff(ylim)/diff(xlim)
10 }