我正在使用ggplot2
和plot3d
在2D和3D中进行相同的散点图。我总是喜欢尽可能地在coord_fixed()
散点图中进行ggplot2
,以提高可读性。有没有办法在scatter3D
图中执行相同的操作?谢谢
MWE:
data(iris)
head(iris)
library(ggplot2)
ggplot(iris, aes(x=Petal.Length, y=Petal.Width)) +
geom_point(pch=16) + theme_light() + coord_fixed()
library(plot3D)
scatter3D(iris$Petal.Length, iris$Sepal.Length, iris$Petal.Width, bty = "u", pch = 16, alpha = 0.5,
xlab = "Petal.Length", ylab = "Sepal.Length", zlab = "Petal.Width", phi = 0, theta = 40,
col.panel = "white", col.grid = "gray", col="black", ticktype = "detailed")
答案 0 :(得分:2)
scale = FALSE
执行此操作:
scatter3D(iris$Petal.Length, iris$Sepal.Length, iris$Petal.Width, bty = "u", pch = 16, alpha = 0.5,
xlab = "Petal.Length", ylab = "Sepal.Length", zlab = "Petal.Width", phi = 0, theta = 40,
col.panel = "white", col.grid = "gray", col="black", ticktype = "detailed",
scale = FALSE)
来自?persp
:
如果scale为TRUE,则分别转换x,y和z坐标。如果scale为FALSE,则会缩放坐标,以便保留宽高比