gpt4 book ai didi

matplotlib - 如何将 PyPlot 图形保存到 Julia 中的视频文件?

转载 作者:行者123 更新时间:2023-12-04 02:18:29 25 4
gpt4 key购买 nike

我想使用循环和 PyPlot 在图形窗口中绘制类似下面的内容。我的问题是如何在循环中将图形窗口保存到电影文件中?

using PyPlot

for k=1:5
pcolormesh(rand(10,10))
if k==1; colorbar(); end
# save figure window to movie file here??
sleep(.5)
end

最佳答案

这可以通过直接使用 matplotlibanimation 子模块(PyPlot.jl 包装的底层 Python 库)来实现。然而,这是痛苦的;参见例如以下笔记本(西类牙语):

https://github.com/dpsanders/fisica_computacional/blob/master/como_animar.ipynb

然而,最简单的方法似乎是使用 Plots.jl:

https://github.com/tbreloff/ExamplePlots.jl/blob/master/docs/pyplot_examples.md#functions-adding-data-and-animations .

关于matplotlib - 如何将 PyPlot 图形保存到 Julia 中的视频文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33439390/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com