diff --git a/REQUIRE b/REQUIRE index 1488666b..a3780a85 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,4 @@ julia 0.4- Colors +Reexport diff --git a/src/Plots.jl b/src/Plots.jl index 52fddabd..ce643933 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -2,7 +2,8 @@ __precompile__() module Plots -using Colors +using Reexport +@reexport using Colors export plotter, @@ -93,6 +94,11 @@ savepng(plt::PlottingObject, args...; kw...) = savepng(plt.plotter, plt, args... savepng(::PlottingPackage, plt::PlottingObject, fn::AbstractString, args...) = error("unsupported") # fallback so multiple dispatch doesn't get confused if it's missing +function __init__() + global const CURRENT_BACKEND = pickDefaultBackend() + println("[Plots.jl] Default backend: ", CURRENT_BACKEND.sym) +end + # --------------------------------------------------------- end # module diff --git a/src/plot.jl b/src/plot.jl index 60c8acc7..d3c4996f 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -117,7 +117,7 @@ end # Then once inputs have been converted, build the series args, map functions, etc. # This should cut down on boilerplate code and allow more focused dispatch on type -typealias FuncOrFuncs Union(Function, AVec{Function}) +typealias FuncOrFuncs Union{Function, AVec{Function}} # missing convertToAnyVector(v::Void; kw...) = Any[nothing] diff --git a/src/plotter.jl b/src/plotter.jl index 8bf1808d..e86b2037 100644 --- a/src/plotter.jl +++ b/src/plotter.jl @@ -48,34 +48,40 @@ CurrentBackend(sym::Symbol) = CurrentBackend(sym, backend(sym)) function pickDefaultBackend() try - Pkg.installed("Immerse") - return CurrentBackend(:immerse) + if Pkg.installed("Immerse") != nothing + return CurrentBackend(:immerse) + end end try - Pkg.installed("Qwt") - return CurrentBackend(:qwt) + if Pkg.installed("Qwt") != nothing + return CurrentBackend(:qwt) + end end try - Pkg.installed("PyPlot") - return CurrentBackend(:pyplot) + if Pkg.installed("PyPlot") != nothing + return CurrentBackend(:pyplot) + end end try - Pkg.installed("Gadfly") - return CurrentBackend(:gadfly) + if Pkg.installed("Gadfly") != nothing + return CurrentBackend(:gadfly) + end end try - Pkg.installed("UnicodePlots") - return CurrentBackend(:unicodeplots) + if Pkg.installed("UnicodePlots") != nothing + return CurrentBackend(:unicodeplots) + end end try - Pkg.installed("Winston") - return CurrentBackend(:winston) + if Pkg.installed("Winston") != nothing + return CurrentBackend(:winston) + end end warn("You don't have any of the supported backends installed! Chose from ", backends()) return CurrentBackend(:gadfly) end -const CURRENT_BACKEND = pickDefaultBackend() -println("[Plots.jl] Default backend: ", CURRENT_BACKEND.sym) +# const CURRENT_BACKEND = pickDefaultBackend() +# println("[Plots.jl] Default backend: ", CURRENT_BACKEND.sym) # --------------------------------------------------------- diff --git a/test/REQUIRE b/test/REQUIRE index 89b650ca..d7bfba89 100644 --- a/test/REQUIRE +++ b/test/REQUIRE @@ -1,6 +1,7 @@ julia 0.4- Colors +Reexport FactCheck PyPlot UnicodePlots