plot3d -如何改变框颜色和删除轴蜱

时间:2021-08-14 23:39:35

I'm trying to make some visual modifications to the default plot3d object. Specifically i would like to put a light box color as a background (only in the box, not the whole palette) and remove the axis tick marks (the x,y,z values on the axis are distracting). I have spent countless hours googling what options to change, but I cannot for the life of me figure this out. Any help would be super appreciated.

我想对默认的plot3d对象进行一些视觉修改。具体地说,我希望将一个灯箱颜色作为背景色(只在方框中,而不是整个调色板中),并删除轴上的勾号(轴上的x、y、z值会让人分心)。我花了无数个小时在谷歌上搜索要改变的选项,但我却始终无法找到答案。任何帮助都将非常感谢。

I whittled down my code to the following, so that you can re-produce it.

我将我的代码缩减到下面,以便您可以重新生成它。

library(rgl)

xvar <- c(0.23158792, 0.09686823, -0.58937138, -1.04380419,0.52169760, 1.15218492, 1.36873947,
      -0.91592078, -0.66918513, -0.15279666)
yvar <- c(-1.06993703, 1.51913070 , 1.45069457, -0.78186861, -0.05373430, 0.45442899, 0.04408369,
      -0.31418560, -0.20741901, -1.04119340)
zvar <- c(0.39326652, 0.72391174, -0.07690784, 0.37914638, 0.43709349, -1.28395765, -1.31900029,
      0.52676516, 0.37331202, -0.15362952)
colgroup <- c(2,4,4,2,2,3,3,2,2,2)
brands <- c('a','b','c','d','e','f','g','h','i','j')

plot3d(xvar, yvar, zvar, bbox=TRUE,
   type="s", col=colgroup, 
   size=0.05, alpha=0.50, radius=0.2,
   xlab="Cost Leader", ylab="Performance Leader", zlab="Fashion Leader")
text3d(x = xvar, y = yvar, z = zvar
   text = brands, adj=c(2.5,2.5), cex=0.7)

Questions:

问题:

  1. How can i put a light shade in the 3D-box so that it's not white

    我怎么能在3d盒子里放一个浅色的,使它不是白色的呢

  2. How can i remove the x,y,z tick marks and their values on the axis so that the plot is a little less distracting.

    如何去掉x,y,z轴上的勾号以及它们在轴上的值,这样图就不会那么分散注意力了。

Thanks in advance!

提前谢谢!

Regards, Siddarth

问候,Siddarth

1 个解决方案

#1


3  

You can manually add a bounding box using the rgl.bbox or bbox3d functions:

您可以使用rgl手动添加边框。bbox或bbox3d功能:

plot3d(xvar, yvar, zvar, type = 's', col = colgroup, size = 0.05, alpha = 0.50, 
       radius = 0.2, xlab = 'Cost Leader', ylab = 'Performance Leader', 
       zlab = 'Fashion Leader', axes = FALSE)
rgl.bbox(xlen = 0, ylen = 0, zlen = 0, color = c('grey100'))
text3d(x = xvar, y = yvar, z = zvar, text = brands, adj = c(2.5,2.5), cex = 0.7)

plot3d -如何改变框颜色和删除轴蜱

#1


3  

You can manually add a bounding box using the rgl.bbox or bbox3d functions:

您可以使用rgl手动添加边框。bbox或bbox3d功能:

plot3d(xvar, yvar, zvar, type = 's', col = colgroup, size = 0.05, alpha = 0.50, 
       radius = 0.2, xlab = 'Cost Leader', ylab = 'Performance Leader', 
       zlab = 'Fashion Leader', axes = FALSE)
rgl.bbox(xlen = 0, ylen = 0, zlen = 0, color = c('grey100'))
text3d(x = xvar, y = yvar, z = zvar, text = brands, adj = c(2.5,2.5), cex = 0.7)

plot3d -如何改变框颜色和删除轴蜱