swh:1:snp:a4c99a50dc49f82b591f268001b320f8c3ca0041
Tip revision: dc000f2a5f006d137f66716b086025d618bf8306 authored by John M Chambers on 14 July 2008, 00:00:00 UTC
version 1.0-5
version 1.0-5
Tip revision: dc000f2
gridSegments.R
require(grid)
require(SoDA)
load("Examples/with_gps1.rda")
pdf("Examples/gridSegments.pdf", width = 4, height=2)
with(gps1, {
xy = geoXY(latitude, longitude)
x = xy[,1]; y = xy[,2]
vlim = range(elevation, na.rm=TRUE)
v = 1.5 * (elevation - vlim[[1]])/diff(vlim) + 0.5
xlim = range(x, na.rm=TRUE); ylim = range(y, na.rm=TRUE)
ylim[1] <- ylim[1] + .5* (diff(ylim))
pushViewport(viewport(width = unit(4, "inches"), height = unit(2, "inches")))
pushViewport(plotViewport(rep(2,4)))
pushViewport(dataViewport(xscale = xlim, yscale = ylim))
show <- y >= ylim[1]
xn <- unit(x[show], "native"); yn <- unit(y[show], "native")
segObject <- grid.segments(xn, yn, xn, yn + unit(v[show], "lines"))
## browser()
})
dev.off()