1

ggplot2我在 2D 和 3D 中使用和绘制相同的散点图plot3d。为了更好的可读性,我总是喜欢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")

图。1

图2

4

1 回答 1

3

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,则缩放坐标以保留纵横比

于 2019-02-22T03:36:34.930 回答