gpt4 book ai didi

R plotly : 3D surface reverse x-axis

转载 作者:行者123 更新时间:2023-12-02 02:32:49 25 4
gpt4 key购买 nike

我正在尝试设置 3D 曲面图的相机,使得 x 轴从左 = 0 到右 = 60,y 轴从底部 = 0 到顶部 = 80,同时 z 轴位于左侧。

有一个例子:

library(plotly)
library(magrittr)

plot_ly(z = ~volcano) %>%
add_surface() %>%
layout(scene = list(camera=list()))

这是默认输出:
enter image description here

这就是我想要的:
enter image description here

我尝试更改 x , y ,和z参数来自eye()功能没有成功。我还尝试使用xasix = list(autoarante = "reversed") .

最佳答案

eye矢量决定相机的位置,默认值为(x = 1.25,y = 1.25,z = 1.25)。

要更改默认值以获得所需的视角,您可以设置 ycamera eye为负值。

library(plotly)
library(magrittr)

plot_ly(z = ~volcano) %>%
add_surface() %>%
layout(scene = list(camera=list(eye = list(x = .8, y = -2, z = 1.25))))

输出

plotly plot of volcano with camera eye changed in layout

关于R plotly : 3D surface reverse x-axis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64785641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com