Merge pull request #2497 from keorn/patch-1

Allow for Plotly JSON saving
This commit is contained in:
Daniel Schwabeneder 2020-03-22 17:59:38 +01:00 committed by GitHub
commit 6cd8b8ff8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,6 +52,14 @@ function tex(plt::Plot, fn::AbstractString)
end
tex(fn::AbstractString) = tex(current(), fn)
function json(plt::Plot, fn::AbstractString)
fn = addExtension(fn, "json")
io = open(fn, "w")
show(io, MIME("application/vnd.plotly.v1+json"), plt)
close(io)
end
json(fn::AbstractString) = json(current(), fn)
function html(plt::Plot, fn::AbstractString)
fn = addExtension(fn, "html")
io = open(fn, "w")
@ -78,6 +86,7 @@ const _savemap = Dict(
"ps" => ps,
"eps" => eps,
"tex" => tex,
"json" => json,
"html" => html,
"tikz" => tex,
"txt" => txt,