atom fix; add_backend for pyplot/plotly/plotlyjs; closes #449
This commit is contained in:
parent
959da6c5ae
commit
60c8f6f578
@ -69,6 +69,7 @@ export
|
|||||||
backend,
|
backend,
|
||||||
backends,
|
backends,
|
||||||
backend_name,
|
backend_name,
|
||||||
|
add_backend,
|
||||||
aliases,
|
aliases,
|
||||||
dataframes,
|
dataframes,
|
||||||
|
|
||||||
|
|||||||
@ -44,6 +44,9 @@ include("backends/web.jl")
|
|||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|
||||||
|
add_backend(pkg::Symbol) = add_backend(_backend_instance(pkg))
|
||||||
|
add_backend(b::AbstractBackend) = warn("No custom install defined for $(backend_name(b))")
|
||||||
|
|
||||||
# don't do anything as a default
|
# don't do anything as a default
|
||||||
_create_backend_figure(plt::Plot) = nothing
|
_create_backend_figure(plt::Plot) = nothing
|
||||||
_prepare_plot_object(plt::Plot) = nothing
|
_prepare_plot_object(plt::Plot) = nothing
|
||||||
|
|||||||
@ -47,6 +47,11 @@ is_string_supported(::PlotlyBackend) = true
|
|||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function add_backend(::PlotlyBackend)
|
||||||
|
Pkg.build("Plots")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
const _plotly_js_path = joinpath(dirname(@__FILE__), "..", "..", "deps", "plotly-latest.min.js")
|
const _plotly_js_path = joinpath(dirname(@__FILE__), "..", "..", "deps", "plotly-latest.min.js")
|
||||||
|
|
||||||
function _initialize_backend(::PlotlyBackend; kw...)
|
function _initialize_backend(::PlotlyBackend; kw...)
|
||||||
|
|||||||
@ -11,6 +11,17 @@ is_string_supported(::PlotlyJSBackend) = true
|
|||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
function add_backend(::PlotlyJSBackend)
|
||||||
|
if !is_installed("PlotlyJS")
|
||||||
|
Pkg.add("PlotlyJS")
|
||||||
|
@eval import Blink
|
||||||
|
Blink.AtomShell.install()
|
||||||
|
Pkg.add("Rsvg")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function _initialize_backend(::PlotlyJSBackend; kw...)
|
function _initialize_backend(::PlotlyJSBackend; kw...)
|
||||||
@eval begin
|
@eval begin
|
||||||
import PlotlyJS
|
import PlotlyJS
|
||||||
|
|||||||
@ -47,6 +47,14 @@ is_subplot_supported(::PyPlotBackend) = true
|
|||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function add_backend(::PyPlotBackend)
|
||||||
|
if !is_installed("PyPlot")
|
||||||
|
withenv("PYTHON" => "") do
|
||||||
|
Pkg.add("PyPlot")
|
||||||
|
Pkg.build("PyPlot")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function _initialize_backend(::PyPlotBackend)
|
function _initialize_backend(::PyPlotBackend)
|
||||||
@eval begin
|
@eval begin
|
||||||
|
|||||||
@ -255,9 +255,15 @@ function setup_atom()
|
|||||||
# @eval import Atom, Media
|
# @eval import Atom, Media
|
||||||
@eval import Atom
|
@eval import Atom
|
||||||
|
|
||||||
|
# default text/plain passes to html... handles Interact issues
|
||||||
|
function Base.show(io::IO, m::MIME"text/plain", plt::Plot)
|
||||||
|
show(io, MIME("text/html"), plt)
|
||||||
|
end
|
||||||
|
|
||||||
# for inline values, display the plot (gui) and return a graph icon
|
# for inline values, display the plot (gui) and return a graph icon
|
||||||
function Atom.Media.render(::Atom.Inline, plt::Plot)
|
function Atom.Media.render(::Atom.Inline, plt::Plot)
|
||||||
display(PlotsDisplay(), plt)
|
# info("using Media.render")
|
||||||
|
display(plt)
|
||||||
Atom.icon("graph")
|
Atom.icon("graph")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user