Merge pull request #2997 from daschw/plotlybase
Replace ORCA with Plotlybase
This commit is contained in:
commit
11f3715453
@ -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
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user