PlotlyJS.jl
PlotlyJS.jl copied to clipboard
plotting svg
Wondering if such a snippet would come in handy to others? This plots the Plotly plots in SVG. Comes in handy when I export my notebooks to share with others using html.
function plot_svg(p::PlotlyJS.SyncPlot)
fn,_ = mktemp()
fn = join([fn, ".svg"])
savefig(p, fn)
open(fn) do f
display("image/svg+xml", read(f, String))
end
end
Hi @asbisen looks cool.
I actually implemented some changes in ORCA that would allow you to write directly ot an iostream instead of only to a file so you could do something like this (untested)
function plot_svg(p::PlotlyBase.Plot)
io = IOBuffer()
savefig(io, p, format="svg")
display("image/svg+xml", String(take!(io)))
end
plot_svg(p::PlotlyJS.SyncPlot) = plot_svg(p.plot)