在 scatterplot3d 中指定轴标签的方向 [英] Specifying the orientation of the axes labels in scatterplot3d

查看:61
本文介绍了在 scatterplot3d 中指定轴标签的方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以在 scatterplot3d 中指定轴标签的方向?我希望 y 轴标签 (wt) 与 y 轴平行,而不像现在这样与 z 轴平行:

I was wondering if it is possible to specify the orientation of the axes labels in scatterplot3d? I'd like the y axis label (wt) to be parallel to the y axis and not parallel to the z axis as it is now:

library(scatterplot3d)
with(mtcars, {
   scatterplot3d(disp, wt, mpg, main="")
})

推荐答案

目前它是硬编码的.您可以创建一个新的 scatterplot3d 函数并将 mtext2 函数定义替换为稍微修改过的版本,该版本将接受 'las' 参数,然后调用该函数以获取 'ylab' 一个不同的值 (2).

At the moment it is hard-coded. You can create a new scatterplot3d function and replace the mtext2 function definition with a slightly modified version that will accept a 'las' argument and then give the call to that function for 'ylab' a different value (2).

  ......
  mytext2 <- function(lab, side, line, at, las=0) mtext(lab, side = side, 
         line = line, at = at, col = col.lab, cex = cex.lab, 
         font = font.axis, las = las)   # shift hard coding to a default value
     lines(c(x.min, x.max), c(z.min, z.min), col = col.axis, 
         lty = lty.axis)
     mytext2(xlab, 1, line = 1.5, at = mean(x.range))
     lines(xx[1] + c(0, y.max * yx.f), c(z.min, y.max * yz.f + 
         z.min), col = col.axis, lty = lty.axis)
     mytext2(ylab, if (angle.1) 
         2
     else 4,  las=2, line = 0.5, at = z.min + y.max * yz.f)  # 2nd change
    .....

这篇关于在 scatterplot3d 中指定轴标签的方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆