【问题标题】:How to plot a 3-D function using Julia's Plots package?如何使用 Julia 的 Plots 包绘制 3-D 函数?
【发布时间】:2020-12-24 09:31:30
【问题描述】:

是否可以使用 Julia Plots 包重现此图? Plotting using gnuplot

x = y = -15:0.4:15
f1 = (x,y) -> @. sin(sqrt(x*x+y*y))/sqrt(x*x+y*y)
surf(x, y, f1, w = :p, marker = "dot", Axes(hidden3d = :on))

【问题讨论】:

  • 是的,有可能。

标签: plot julia gnuplot


【解决方案1】:

不完全相同,但您可以使用surface 绘制曲面:

using Plots
x = y = -15:0.4:15
f(x,y) = sin(sqrt(x^2+y^2))/sqrt(x^2+y^2)
surface(x, y, f)

这会给

wireframe

wireframe(x, y, f)

会给

但如果你真的想要一个 3D 散点图,那么你需要手动创建网格并将数据重新排列成我认为的向量,比如

X = [x for x in x for y in y]
Y = [y for x in x for y in y]
scatter3d(X, Y, f.(X,Y))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多