diff --git a/src/backends/orca.jl b/src/backends/orca.jl new file mode 100644 index 00000000..cfd33fe7 --- /dev/null +++ b/src/backends/orca.jl @@ -0,0 +1,15 @@ +function plotlybase_syncplot(plt::Plot) + plt.o = ORCA.PlotlyBase.Plot() + traces = ORCA.PlotlyBase.GenericTrace[] + for series_dict in plotly_series(plt) + plotly_type = pop!(series_dict, :type) + push!(traces, ORCA.PlotlyBase.GenericTrace(plotly_type; series_dict...)) + end + ORCA.PlotlyBase.addtraces!(plt.o, traces...) + layout = plotly_layout(plt) + w, h = plt[:size] + ORCA.PlotlyBase.relayout!(plt.o, layout, width = w, height = h) + return plt.o +end + +_show(io::IO, ::MIME{Symbol("image/png")}, plt::Plot{PlotlyBackend}) = ORCA.PlotlyBase.savefig(io, plotlybase_syncplot(plt), format = "png") diff --git a/src/init.jl b/src/init.jl index ee629f73..c6213001 100644 --- a/src/init.jl +++ b/src/init.jl @@ -46,6 +46,12 @@ function __init__() @require Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" Revise.track(Plots, fn) end + @require ORCA = "47be7bcc-f1a6-5447-8b36-7eeeff7534fd" begin + fn = joinpath(@__DIR__, "backends", "orca.jl") + include(fn) + @require Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" Revise.track(Plots, fn) + end + @require PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925" begin fn = joinpath(@__DIR__, "backends", "pgfplotsx.jl") include(fn)