reexport Colors; move default backend choice into __init__; fixed pickDefaultBackend

This commit is contained in:
Thomas Breloff 2015-09-22 08:10:30 -04:00
parent f2bcb77cfb
commit f8fb473981
5 changed files with 30 additions and 16 deletions

View File

@ -1,3 +1,4 @@
julia 0.4-
Colors
Reexport

View File

@ -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

View File

@ -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]

View File

@ -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)
# ---------------------------------------------------------

View File

@ -1,6 +1,7 @@
julia 0.4-
Colors
Reexport
FactCheck
PyPlot
UnicodePlots