在Julia中使用Plotly设置3D的相机设置。

问题描述 投票:1回答:1

我在一个交互式的三维图中有一个曲面和一个点。但我想改变一开始看到的第一个视图的角度,使曲面看起来是一条线。我不能改变曲面,因为那是基于给定数据的。所以我需要找到一种方法来设置相机的设置。我发现在使用R和Python的时候可以做到这一点,但是在Julia上是如何工作的呢?

谁能帮帮我?

下面是一个简单的代码示例。

using Plotly

x = [-10,-10,10];
y = [-10,10,-10];
z = [10,-5,-10];
trace1 = mesh3d(color = "red",x=x,y=y,z=z,scaleratio = 1)
trace2 = Plotly.scatter3d(color = "blue";x=[3], y=[1],z = [2], mode="markers")
layout = Layout(;scene=attr(;xaxis=attr(;range=[-10, 10]),yaxis=attr(;range=[-10, 10]),zaxis=attr(;range=[-10, 10]), aspectratio=attr(x=1, y=1, z=1)))
plt = Plotly.plot([trace1,trace2],layout)
3d julia plotly angle
1个回答
0
投票

我找到了一个方法,使用Plots与后台pylplot().如果有人对这个感兴趣,我把解决方案贴出来。

pyplot()

angle1 = 10;
angle2 = 30; 

x = [-10,-10,10];
y = [-10,10,-10];
z = [10,-5,-10];
plt = surface([(x[1],y[1],z[1]),(x[2],y[2],z[2]),(x[3],y[3],z[3])],alpha=.1, fillalpha=.1, camera = (angle1,angle2), xlabel = "x", ylabel = "y", zlabel = "z")
© www.soinside.com 2019 - 2024. All rights reserved.