简体   繁体   中英

plot3d - how to change box color and remove axis ticks

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.

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

  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.

Thanks in advance!

Regards, Siddarth

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

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)

3d图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM