hax*_*tar 4 matplotlib mplot3d julia
我正在尝试改变 3D 散点图的视角。(朱莉娅语言)
例如,此代码更改了视角,但每次更改时都会单独绘制这些点,而不是一起绘制。
for i=1:10
X=i; Y=i+2; Z = i+3
fig = figure()
ax = gca(projection="3d")
plot3D([X],[Y],[Z], ".")
ax[:view_init](30, 180)
end
Run Code Online (Sandbox Code Playgroud)
我该如何写这篇文章,以便我以不同的视角看待所有要点?Julia 中的格式改编自 matplotlib,因此它应该与 Julia 中的格式非常相似。
只需将图形创建从循环中取出即可。您正在每次迭代中创建一个新图形。
using PyPlot
fig = figure()
ax = gca(projection="3d")
for i=1:10
X=i; Y=i+2; Z = i+3
plot3D([X],[Y],[Z], ".")
ax[:view_init](30, 180)
end
Run Code Online (Sandbox Code Playgroud)
这样做你想要的吗?