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

查看:20
本文介绍了更改视图、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天全站免登陆