Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 3D 散点图 (plot_ly),默认情况下所有轴的长度都相同 - 当然比例不同。我想沿着一个轴(x)伸展,有没有办法做到这一点?
示例代码使用mtcars:
mtcars
> plot_ly(mtcars, x = ~ wt, y = ~ disp, z = ~mpg, type = "scatter3d", mode = "marker", opacity = 0.6)
我可以缩放或旋转绘图,但我希望默认的 x 轴是 y 和 z 轴的两倍。
也许你可以试试这个:
plot_ly(mtcars, x = ~ wt, y = ~ disp, z = ~mpg, type = "scatter3d", mode = "marker", opacity = 0.6) %>% layout(scene = list(aspectmode = "manual", aspectratio = list(x=1, y=0.2, z=0.2)))
只需aspectratio根据需要调整即可。
aspectratio