From c50a5bf12331ab610a141c4244cd93954b7bf1d2 Mon Sep 17 00:00:00 2001 From: keorn Date: Sat, 21 Mar 2020 14:41:56 +0100 Subject: [PATCH] allow plotly json saving --- src/output.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/output.jl b/src/output.jl index 3e0f5bf3..1bd5e9f3 100644 --- a/src/output.jl +++ b/src/output.jl @@ -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,