Hello,

I'm working on some simple copula plots for a poster presentation, and by 
simple I mean simple, gaussian, etc., etc., etc.

I know I might be taking this a bit too far but I'm trying to see if I can 
overlay one surface plot over another.  I want to use color but I like the 
addition of a black wireframe to hold together a better sense of shape.

Right now, I have it set up to create a 300x300 colored surface using 
col="transparent", and I'd like to add a n x n (10, 20, whatever) on top of 
this.  Right now I'm using wireframe and I'm using my employer's official 
colors for gradient coloring.  My code is below.  I apologize for the code 
length but it does execute the way I want from a new session.

I'm also curious as to why I'm some grid effects or lighting effects (unsure of 
which) that I'm using on my personal 3.0.1 copy on Mountain Lion OSX, that I 
wasn't getting on 2.14.1 on Windows XP... something to figure out for another 
time.  This is a much more secondary concern for which I have a solution 
(compile the final graphic at work).  For now I'm just trying to see if its 
possible to lay a smaller resolution grid over the colored high resolution grid.

I will say that other help documents have been very useful to get the code 
along to this point.

Sincerely,

Patrick Joyce

Work e-mail:  patrick.m.jo...@census.gov


library(RColorBrewer)
library(colorspace)


library(lattice)

normal.copula=function(u1,u2,rho){

x1=qnorm(u1)
x2=qnorm(u2)

1/(2*pi)/sqrt(1-rho^2)*exp(-1/2*(x1^2+x2^2-rho*x1*x2)/(1-rho^2))/dnorm(x1)/dnorm(x2)

}

new.census.red="#AB0537"
new.census.blue="#0A6FB7"

ncred=hex2RGB(new.census.red)
ncblue=hex2RGB(new.census.blue)
ncwhite=hex2RGB("#FFFFFF")

census.color.function=function(alpha.cen){
out.hex=ifelse(alpha.cen<.5,hex(mixcolor(2*alpha.cen,ncblue,ncwhite),fixup=TRUE),ifelse(alpha.cen==.5,"#FFFFFF",hex(mixcolor(2*alpha.cen-1,ncwhite,ncred),fixup=TRUE)))

out.hex

}

rho.boat=.7

n.cuts=300
u1.corrd=(1:n.cuts-.5)/n.cuts
u2.corrd=(1:n.cuts-.5)/n.cuts
shareframe=data.frame(expand.grid(u1.corrd,u2.corrd))
shareframe$z.dir=normal.copula(shareframe$Var1,shareframe$Var2,rho.boat)
names(shareframe)=c("u1.dir","u2.dir","z.dir")

plot.new()
wireframe(shareframe$z.dir~ shareframe$u1.dir*shareframe$u2.dir,
  xlab = expression(U[1]), ylab = expression(U[2]), zlab="Density",main=" ",

scales = list(arrows=FALSE,col=1),
  drape = c(TRUE),

par.settings=list(axis.line=list(col="transparent")),col="transparent",colorkey 
= FALSE,
  screen = list(z = 195,y=180, x = 105),col.regions = 
census.color.function((1:10000-.5)/10000))
  

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to