replace ORCA with PlotlyBase

This commit is contained in:
Daniel Schwabeneder 2020-09-21 19:57:04 +02:00
parent f58100b400
commit 2aa3e1a5fc
3 changed files with 5 additions and 28 deletions

View File

@ -367,10 +367,10 @@ is_marker_supported(::GRBackend, shape::Shape) = true
function _initialize_backend(pkg::PlotlyBackend) function _initialize_backend(pkg::PlotlyBackend)
try try
@eval Main begin @eval Main begin
import ORCA import PlotlyBase
end end
catch catch
@info "For saving to png with the Plotly backend ORCA has to be installed." @info "For saving to png with the Plotly backend PlotlyBase has to be installed."
end end
end end
@ -488,7 +488,7 @@ const _pgfplots_scale = [:identity, :ln, :log2, :log10]
function _initialize_backend(pkg::PlotlyJSBackend) function _initialize_backend(pkg::PlotlyJSBackend)
@eval Main begin @eval Main begin
import PlotlyJS, ORCA import PlotlyJS
export PlotlyJS export PlotlyJS
end end
end end

View File

@ -1,23 +0,0 @@
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
for (mime, fmt) in (
"application/pdf" => "pdf",
"image/png" => "png",
"image/svg+xml" => "svg",
"image/eps" => "eps",
)
@eval _show(io::IO, ::MIME{Symbol($mime)}, plt::Plot{PlotlyBackend}) =
ORCA.PlotlyBase.savefig(io, plotlybase_syncplot(plt), format = $fmt)
end

View File

@ -41,8 +41,8 @@ function __init__()
include(fn) include(fn)
end end
@require ORCA = "47be7bcc-f1a6-5447-8b36-7eeeff7534fd" begin @require PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5" begin
fn = joinpath(@__DIR__, "backends", "orca.jl") fn = joinpath(@__DIR__, "backends", "plotlybase.jl")
include(fn) include(fn)
end end