Skip to content

Commit

Permalink
CLN: some minor cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
sglyon committed Sep 6, 2018
1 parent 85f92d3 commit eeb5798
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
8 changes: 0 additions & 8 deletions src/PlotlyJS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down
4 changes: 1 addition & 3 deletions src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
11 changes: 5 additions & 6 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down

0 comments on commit eeb5798

Please sign in to comment.