Change direction of axis title and label in 3dplots in R?

元气小坏坏 提交于 2019-12-02 09:41:26

One is to make the vertical title of those axis horizontal

To do this you need to hide the current label, and use the text() function to add a rotated label in the correct spot; as described here Rotate y-axis label in scatterplot3d (adjust to angle of axis)

set.seed(42)
scatterplot3d(rnorm(20), rnorm(20), rnorm(20), ylab = "")
text(x = 5, y = -2.5, "Y-axis", srt = 45)

and for example put a label "first interval" for 1 in x values and so one and so forth. How an I do it?

From the documentation - https://cran.r-project.org/web/packages/scatterplot3d/scatterplot3d.pdf Use the x.ticklabs attribute, for example:

xlabs <- c("first interval", "second", "third", "fourth", "this is 5")
scatterplot3d(x,y,z, pch =16,main="3D V1 v.s V2",xlab = "Class",ylab = "V1", zlab = "V2", x.ticklabs=xlabs)

Also, how can I make the points linear or plane instead of dots.

Scatterplot3d offers "lines" and "vertical lines", for example:

scatterplot3d(x,y,z , type="l", lwd=5, pch=" ")
#or
scatterplot3d(x,y,z , type="h", lwd=5, pch=" ")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!