Dear R-users,
I'd like to plot a three-dimensional surface and at the meantime I'm using
an array. I would like to have the values of my first matrix in the heights
of the plot and the colors of the single facet taking into account the
second matrix.
I hope that the next code will help all of you to understand better my
issue, 
Thanks in advance, Giancarlo
############################
## creating my array
m1 <- runif(30,min=1, max=10)
m2 <- c(rep(0,12), rep(1,5), rep(0,3), rep(1,30-12-5-3))
mm <- array(c(m1,m2), dim=c(6,5,2))

## colors
colo <- c("red", "blue")

## axis
x  <- 1:6
y  <- 1:5
z  <- mm[,,1]
z1 <- mm[,,2]

## surface with heights and colors 
## related to the first matrix (no good)
persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = colo,
        ltheta = 120, ticktype = "detailed",
        xlab = "X", ylab = "Y", zlab = "values" )

## surface with heights and colors 
## related to the second matrix (no good as well)
persp(x, y, z1, theta = 30, phi = 30, expand = 0.5, col = colo,
        ltheta = 120, ticktype = "detailed",
        xlab = "X", ylab = "Y", zlab = "values" )
############################



+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to