为什么PyPlot无法在我的MAC上的Julia中运行?

时间:2019-05-20 08:46:57

标签: matplotlib julia

我在Julia中使用“ PyPlot”包来绘制高斯图形,遇到了一些错误。我试着不绘制小雕像,没有错误。所以我认为PyPlot可能有问题。

这是我的代码:

using GaussianRandomFields, PyPlot
using Random, Printf, PyCall
pygui(true)
A = [1 0.8; 0.8 1]
an = AnisotropicExponential(A)
cov = CovarianceFunction(2,an)
pts = range(0; stop=10, length=512)
grf = GaussianRandomField(cov,KarhunenLoeve(500),pts,pts)
contourf(grf)
display(contourf(grf))

我得到了这个结果:

2019-05-20 16:20:25.337 julia[28149:332602] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7ffddb7f7d90

2019-05-20 16:20:25.347 julia[28149:332602] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7ffddb7f7d90'

*** First throw call stack:
(
)
libc++abi.dylib: terminating with uncaught exception of type NSException

signal (6): Abort trap: 6
in expression starting at /Users/sat/Documents/Projects/generate_spatial_data.jl/temp.jl:9

__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 245354859 (Pool: 245335221; Big: 19638); GC: 823

有人可以帮忙解决它,谢谢。

1 个答案:

答案 0 :(得分:0)

https://github.com/JuliaPy/PyPlot.jl/issues/405

可以通过安装兼容的matplotlib后端来解决。