我在Pluto中使用Gadfly,我正在尝试弄清楚是否有可能在Pluto笔记本中有交互式版本的绘图。如果我只使用REPL,Gadfly会生成非常好的交互式绘图,并在我的web浏览器中打开:
using Gadfly
plot([sin, cos], 0 , 4)但是,如果我在Pluto中使用Gadfly,notebook中包含的绘图不是交互式的,它们是静态的。这是一个简单的Pluto笔记本示例:
### A Pluto.jl notebook ###
# v0.12.20
using Markdown
using InteractiveUtils
# ╔═╡ 7bb74118-73d1-11eb-2bd5-c1ef89972288
using Gadfly
# ╔═╡ 9080ac2e-73d1-11eb-18d6-5f85903a7259
plot([sin, cos], 0 , 4)
# ╔═╡ Cell order:
# ╠═7bb74118-73d1-11eb-2bd5-c1ef89972288
# ╠═9080ac2e-73d1-11eb-18d6-5f85903a7259如何在Pluto中拥有Gadfly plots的交互式版本?
任何帮助都是非常感谢的!
发布于 2021-06-29 22:12:44
遵循https://github.com/fonsp/Pluto.jl/issues/546#issuecomment-705556778中的建议
您可以定义:
struct HTMLDocument
embedded
end
function Base.show(io::IO, mime::MIME"text/html", doc::HTMLDocument)
println(io, "<html>")
show(io, mime, doc.embedded)
println(io, "</html>")
end然后做
plot([sin, cos], 0 , 4) |> HTMLDocument在冥王星中获得交互式绘图。
最好的
https://stackoverflow.com/questions/66297678
复制相似问题