更改视图,plot3D,Julia语言(类似于matplotlib) [英] change view, plot3D, Julia language (similar to matplotlib)

查看:176
本文介绍了更改视图,plot3D,Julia语言(类似于matplotlib)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改3D散点图的透视图. (朱莉娅语言)

I'm trying to change the perspective of a 3D scatter plot. (Julia Language)

例如,此代码更改了透视图,但是每次更改时都单独绘制了点,而不是一起绘制了点.

This code, for example, changes the perspective, but the points are plotted individually with each change, rather than together.

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

我该如何写成这样,以便以改变的视角看待所有要点? Julia中的格式改编自matplotlib,因此它应与Julia中的格式非常相似.

How can I write this so that I see all the points together in a changed perspective? The format in Julia is adapted from matplotlib, so it should be very similar to how it is accomplished in Julia.

推荐答案

只需将图形创建从循环中移出即可.您将在每次迭代中创建一个新图形.

Just take the figure creation out of the loop. You are creating a new figure in each iteration.

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

那是你想要的吗?

这篇关于更改视图,plot3D,Julia语言(类似于matplotlib)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆