From eeb5798bb2409935e178b416bb96ba01da33e409 Mon Sep 17 00:00:00 2001 From: Spencer Lyon Date: Thu, 6 Sep 2018 16:59:58 -0400 Subject: [PATCH] CLN: some minor cleanups --- src/PlotlyJS.jl | 8 -------- src/display.jl | 4 +--- src/util.jl | 11 +++++------ 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/PlotlyJS.jl b/src/PlotlyJS.jl index f6e3b54c..8d22d6f0 100644 --- a/src/PlotlyJS.jl +++ b/src/PlotlyJS.jl @@ -3,7 +3,6 @@ module PlotlyJS using Reexport @reexport using PlotlyBase using JSON -using Base.Iterators using REPL, Pkg # need to import some functions because methods are meta-generated @@ -29,16 +28,9 @@ const _js_cdn_path = "https://cdn.plot.ly/plotly-latest.min.js" const _mathjax_cdn_path = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_SVG" -const _autoresize = [true] -autoresize(b::Bool) = (_autoresize[1] = b; b) -autoresize() = _autoresize[1] - -abstract type AbstractPlotlyDisplay end - # include the rest of the core parts of the package include("display.jl") include("util.jl") -# include("savefig.jl") function docs() schema_path = joinpath(dirname(dirname(@__FILE__)), "deps", "schema.html") diff --git a/src/display.jl b/src/display.jl index efa7a808..c596ee04 100644 --- a/src/display.jl +++ b/src/display.jl @@ -157,9 +157,7 @@ end # Add some basic Julia API methods on SyncPlot that just forward onto the Plot Base.size(sp::SyncPlot) = size(sp.plot) -function Base.copy(sp::SyncPlot) - SyncPlot(copy(sp.plot), options=copy(sp.options)) -end +Base.copy(sp::SyncPlot) = SyncPlot(copy(sp.plot), options=copy(sp.options)) function Base.display(::REPL.REPLDisplay, p::SyncPlot) p.window = Blink.Window() diff --git a/src/util.jl b/src/util.jl index 6f5a176a..714946bd 100644 --- a/src/util.jl +++ b/src/util.jl @@ -4,12 +4,11 @@ JSON.lower(sp::SyncPlot) = JSON.lower(sp.plot) PlotlyBase._is3d(p::SyncPlot) = _is3d(p.plot) # subplot methods on syncplot -Base.hcat(sps::TP...) where {TP<:SyncPlot} = TP(hcat([sp.plot for sp in sps]...)) -Base.vcat(sps::TP...) where {TP<:SyncPlot} = TP(vcat([sp.plot for sp in sps]...)) -Base.vect(sps::TP...) where {TP<:SyncPlot} = vcat(sps...) -Base.hvcat(rows::Tuple{Vararg{Int}}, sps::TP...) where {TP<:SyncPlot} = - TP(hvcat(rows, [sp.plot for sp in sps]...)) - +Base.hcat(sps::SyncPlot...) = SyncPlot(hcat([sp.plot for sp in sps]...)) +Base.vcat(sps::SyncPlot...) = SyncPlot(vcat([sp.plot for sp in sps]...)) +Base.vect(sps::SyncPlot...) = vcat(sps...) +Base.hvcat(rows::Tuple{Vararg{Int}}, sps::SyncPlot...) = + SyncPlot(hvcat(rows, [sp.plot for sp in sps]...)) function PlotlyBase.add_recession_bands!(p::SyncPlot; kwargs...) new_shapes = add_recession_bands!(p.plot; kwargs...)