开发者

How do you set the y-axis labels using axis3d?

I开发者_如何学运维'm using the following data and code to create a 3D plot, but the axes3d command for the y axis is repeating labels. What do I need to do differently to have the y-axis only display the text in the ylabels list?

Here is my data

"V2" "V3" "V4" "V5" "V6" "V7" "V8" "V9" "V10" "V11" "V12"
"A" 0.04 0 -0.12 -0.11 0.07 -0.1 -0.64 -0.41 -0.33 -0.23 0.11
"B" 0.04 0 -0.11 -0.08 0.08 -0.37 -0.52 -0.34 -0.33 -0.23 0.09
"C" 0.03 -0.06 -0.13 -0.13 0 -0.12 0.14 0.01 -0.12 -0.02 0.12
"D" 0.07 -0.06 -0.13 -0.12 -0.03 -0.12 0.15 0 -0.14 -0.07 0.16

and here is the code

open3d()
yred <- colorRampPalette(c("blue","red"))
# par3d(windowRect=c(100,100,700,700),zoom=1.25) 
pm <- persp3d(z=t(d), col=rep(rep(yred(nrow(d)/1),each=1), each=(ncol(d)-1)),
              axes=F, xlab="", ylab="", zlab="", box=T)
axes3d("z", pos=c(0,1,0))
ylabels <- row.names(d)
axis3d("y", nticks=length(ylabels), labels=ylabels)


I do not know why but this works:

open3d()
yred <- colorRampPalette(c("blue","red"))
# par3d(windowRect=c(100,100,700,700),zoom=1.25) 
pm <- persp3d(z=t(d), col=rep(rep(yred(nrow(d)/1),each=1), each=(ncol(d)-1)),
              axes=F, xlab="", ylab="", zlab="", box=T)
axes3d("z", pos=c(0,1,0))
ylabels <- rownames(d)
axis3d("y", at=seq(0,1, length = length(ylabels)), labels=ylabels, nticks=4)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜