Skip to content

3d Map with bars

1 message · partha_bagchi@hgsi.com

#
Ray,

Thanks very much. That did it. 

Partha





Ray Brownrigg <ray at mcs.vuw.ac.nz>
11/21/2004 06:38 PM

 
        To:     ligges at statistik.uni-dortmund.de, partha_bagchi at hgsi.com
        cc:     r-help at stat.math.ethz.ch
        Subject:        Re: [R] Re: 3d Map with bars
plot.
Try something like this:

library(maps)
states <- map("state", plot=F)
x1 <- rep(0, 3)
x2 <- rep(0, 3)
maxz <- 1
z <- matrix(c(0, 0, 0, 0, 0, 0, maxz, maxz, maxz), 3, 3)
x1[-2] <- states$range[1:2]
x2[-2] <- states$range[3:4]
x1[2] <- x1[3] - 1e-6
x2[2] <- x2[3] - 1e-6
pmat <- persp(x1, x2, z, xlab = "", ylab = "", zlab="", axes = F,
theta=0, phi=20, d=10)
lines(trans3d(states$x, states$y, 0, pmat))
latitude <- -90
longitude <- 37
myz <- 0.6
lines(trans3d(rep(latitude, 2), rep(longitude, 2), c(0, myz), pmat), 
col=2)

where trans3d is as defined in the examples for persp().

Hope this helps,
Ray Brownrigg

----
the
different