How to change the distance or rotation of the axis heading of a graph relative to the axis itself

Asked

Viewed 93 times

5

I make the graphic below using the plot3D package of R. I would like to move the label a little away from the z axis ($f(y_{1},y_{2})$) of the values of the axis or leave it horizontal. Does anyone know how I can proceed? Follow the code:

library("plot3D")
#Function density probability
library(pbivnorm)
bsb <- function(t1,t2){
  a1 <- sqrt(phi1/2)*(sqrt(((phi1+1)*t1)/(phi1*mu1))-sqrt(((phi1*mu1)/((phi1+1)*t1))))
  a2 <- sqrt(phi2/2)*(sqrt(((phi2+1)*t2)/(phi2*mu2))-sqrt(((phi2*mu2)/((phi2+1)*t2))))
  Phi2 <- pbivnorm(a1, a2, rho, recycle = TRUE)
  b1 <- ((phi1+1)/(2*phi1*mu1))*sqrt(phi1/2)*(((phi1*mu1)/((phi1+1)*t1))^(1/2)+((phi1*mu1)/((phi1+1)*t1))^(3/2))
  b2 <- ((phi2+1)/(2*phi2*mu2))*sqrt(phi2/2)*(((phi2*mu2)/((phi2+1)*t2))^(1/2)+((phi2*mu2)/((phi2+1)*t2))^(3/2))
  fdp <- Phi2*b1*b2
  return(fdp)
}

t1 <- seq(0.001,100,length=30)
t2 <- seq(0.001,20,length=40)
#Parameters
mu1=7
phi1=2
mu2=1
phi2=9
rho=0

z<-outer(t1,t2,bsb) # calculate density values
pmat=persp3D(t1, t2, z,
        main="",xlab="$y_{1}$",ylab="$y_{2}$",zlab="$f(y_{1},y_{2})$",cex.axis=1,cex.lab=1,
        col = "gray10",border = "gray40",
        theta=50, phi=15,
        expand=0.9,
        d=2,
        shade=0.3,
        ticktype="detailed",
        nticks=5,
        facets=FALSE,contour = list(nlevels=10,col="gray35"), zlim= c(-0.1, 0.23), bty = "b2")
text(trans3d(0,7.3,0.173,pmat), "(b)",cex=1,col="black")

The figure is like this:

inserir a descrição da imagem aqui

I would like the following images:

inserir a descrição da imagem aqui

1 answer

2


The code below solved my problem by putting the label of the z axis horizontally:

par(mar = c(5.1, 9.1, 4.1, 2.1))
pmat <- persp3D(t1, t2, z, main="", xlab="$y_{1}$", ylab="$y_{2}$", 
    zlab="", cex.axis=1, cex.lab=1,
    col = "gray10", border = "gray40",
    theta=50, phi=15,
    expand=0.9, d=2, shade=0.3,
    ticktype="detailed", nticks=5,
    facets=FALSE, contour = list(nlevels=10,col="gray35"), 
    zlim= c(-0.1, 0.23), bty = "b2")
text(trans3d(0,7.3,0.173,pmat), "(b)", cex=1, col="black")
text(trans3d(0,-3,0.05,pmat), label= "$f(y_{1},y_{2})$", 
     cex=1, col="black", xpd=NA, pos=2)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.