图而不是用于 julia 代理模型的 InteractiveDynamics 应用程序

Figure instead of InteractiveDynamics app for julia agents model

我正在学习 Agents.jl 包 (https://juliadynamics.github.io/Agents.jl/stable/examples/schelling/) 中的 schelling.jl 教程。在教程快结束时,他们创建了一个交互式应用程序。但是当我 运行 脚本 (include("schelling.jl")) 时,我最终得到的是图形而不是交互式应用程序(无法单击 运行、重置按钮,因为它看起来是图形)。我如何将其作为交互式应用程序使用?

using InteractiveDynamics
figure, adf, mdf = abm_data_exploration(model, agent_step!, dummystep, parange; ac=groupcolor, am=groupmarker, as = 10, adata, alabels)

注意我正在使用 vscode IDE

您需要指定合适的绘图后端,CairoMakie 可以输出静态矢量图但无法打开交互式windows。您可以改用 GLMakie 或 WGLMakie。

Package Description
GLMakie.jl GPU-powered, interactive 2D and 3D plotting in standalone GLFW.jl windows.
CairoMakie.jl Cairo.jl based, non-interactive 2D backend for publication-quality vector graphics.
WGLMakie.jl WebGL-based interactive 2D and 3D plotting that runs within browsers.

@见Mackie's Backends & Output