Merge pull request #2306 from daschw/orca

Allow saving to pdf, svg and eps for plotly() via ORCA
This commit is contained in:
Daniel Schwabeneder 2019-12-05 16:38:55 +01:00 committed by GitHub
commit 5051e06be0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,4 +12,13 @@ function plotlybase_syncplot(plt::Plot)
return plt.o
end
_show(io::IO, ::MIME{Symbol("image/png")}, plt::Plot{PlotlyBackend}) = ORCA.PlotlyBase.savefig(io, plotlybase_syncplot(plt), format = "png")
const _orca_mimeformats = Dict(
"application/pdf" => "pdf",
"image/png" => "png",
"image/svg+xml" => "svg",
"image/eps" => "eps",
)
for (mime, fmt) in _orca_mimeformats
@eval _show(io::IO, ::MIME{Symbol($mime)}, plt::Plot{PlotlyBackend}) = ORCA.PlotlyBase.savefig(io, plotlybase_syncplot(plt), format = $fmt)
end