在Colab中的朱莉娅(Julia)制作互动情节
我正在尝试在Google Colab中运行Julia v1.7.3 Noreferrer“>此笔记本中的设置说明。
它的运行良好,但是我遇到了很大的麻烦。许多人似乎也有这个困难,因为在线上有很多不同的页面。
我发现的最有希望的领导是来自Makie的教程滑块。
它们包括以下演示代码:
using GLMakie
fig = Figure()
ax = Axis(fig[1, 1])
lsgrid = labelslidergrid!(
fig,
["Voltage", "Current", "Resistance"],
[0:0.1:10, 0:0.1:20, 0:0.1:30];
formats = [x -> "$(round(x, digits = 1))$s" for s in ["V", "A", "Ω"]],
width = 350,
tellheight = false)
fig[1, 2] = lsgrid.layout
sliderobservables = [s.value for s in lsgrid.sliders]
bars = lift(sliderobservables...) do slvalues...
[slvalues...]
end
barplot!(ax, bars, color = [:yellow, :orange, :red])
ylims!(ax, 0, 30)
set_close_to!(lsgrid.sliders[1], 5.3)
set_close_to!(lsgrid.sliders[2], 10.2)
set_close_to!(lsgrid.sliders[3], 15.9)
fig
但是,当我运行此演示代码时,我会得到一个静态图像,而滑块冻结了!
有谁知道我该怎么做才能使滑块实际上在Google Colab中移动?
I am trying to run Julia v1.7.3 in google colab, following the set-up instructions from this notebook.
It mostly runs well, but I'm having a ton of trouble getting interactive plots to work. A lot of people seem to have this difficulty as well, as there are lots of different pages online.
The most promising lead I've found is this tutorial from Makie about how to use sliders.
They include the following demo code:
using GLMakie
fig = Figure()
ax = Axis(fig[1, 1])
lsgrid = labelslidergrid!(
fig,
["Voltage", "Current", "Resistance"],
[0:0.1:10, 0:0.1:20, 0:0.1:30];
formats = [x -> "$(round(x, digits = 1))$s" for s in ["V", "A", "Ω"]],
width = 350,
tellheight = false)
fig[1, 2] = lsgrid.layout
sliderobservables = [s.value for s in lsgrid.sliders]
bars = lift(sliderobservables...) do slvalues...
[slvalues...]
end
barplot!(ax, bars, color = [:yellow, :orange, :red])
ylims!(ax, 0, 30)
set_close_to!(lsgrid.sliders[1], 5.3)
set_close_to!(lsgrid.sliders[2], 10.2)
set_close_to!(lsgrid.sliders[3], 15.9)
fig
However, when I run this demo code, I get a static image, with the sliders frozen in place!
Does anyone know what I could do to make the sliders actually move in google colab?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论