Merge pull request #2997 from daschw/plotlybase

Replace ORCA with Plotlybase
This commit is contained in:
Daniel Schwabeneder 2020-09-21 21:35:07 +02:00 committed by GitHub
commit 11f3715453
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View File

@ -367,10 +367,10 @@ is_marker_supported(::GRBackend, shape::Shape) = true
function _initialize_backend(pkg::PlotlyBackend)
try
@eval Main begin
import ORCA
import PlotlyBase
end
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
@ -488,7 +488,7 @@ const _pgfplots_scale = [:identity, :ln, :log2, :log10]
function _initialize_backend(pkg::PlotlyJSBackend)
@eval Main begin
import PlotlyJS, ORCA
import PlotlyJS
export PlotlyJS
end
end

View File

@ -1,14 +1,14 @@
function plotlybase_syncplot(plt::Plot)
plt.o = ORCA.PlotlyBase.Plot()
traces = ORCA.PlotlyBase.GenericTrace[]
plt.o = PlotlyBase.Plot()
traces = PlotlyBase.GenericTrace[]
for series_dict in plotly_series(plt)
plotly_type = pop!(series_dict, :type)
push!(traces, ORCA.PlotlyBase.GenericTrace(plotly_type; series_dict...))
push!(traces, PlotlyBase.GenericTrace(plotly_type; series_dict...))
end
ORCA.PlotlyBase.addtraces!(plt.o, traces...)
PlotlyBase.addtraces!(plt.o, traces...)
layout = plotly_layout(plt)
w, h = plt[:size]
ORCA.PlotlyBase.relayout!(plt.o, layout, width = w, height = h)
PlotlyBase.relayout!(plt.o, layout, width = w, height = h)
return plt.o
end
@ -19,5 +19,5 @@ for (mime, fmt) in (
"image/eps" => "eps",
)
@eval _show(io::IO, ::MIME{Symbol($mime)}, plt::Plot{PlotlyBackend}) =
ORCA.PlotlyBase.savefig(io, plotlybase_syncplot(plt), format = $fmt)
PlotlyBase.savefig(io, plotlybase_syncplot(plt), format = $fmt)
end

View File

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