PLOTS_DEFAULT_BACKEND env variable; closes #200

This commit is contained in:
Thomas Breloff 2016-04-23 09:04:02 -04:00
parent 04842974e7
commit d4ccf0ec62
2 changed files with 23 additions and 7 deletions

View File

@ -64,14 +64,30 @@ CurrentBackend(sym::Symbol) = CurrentBackend(sym, _backend_instance(sym))
# ---------------------------------------------------------
function pickDefaultBackend()
for pkgstr in ("PyPlot", "Immerse", "Qwt", "Gadfly", "GR", "UnicodePlots", "Bokeh", "GLVisualize")
if Pkg.installed(pkgstr) != nothing
return backend(symbol(lowercase(pkgstr)))
env_default = get(ENV, "PLOTS_DEFAULT_BACKEND", "")
if env_default != ""
try
Pkg.installed(env_default) # this will error if not installed
sym = symbol(lowercase(env_default))
if haskey(_backendType, sym)
return backend(sym)
else
warn("You have set PLOTS_DEFAULT_BACKEND=$env_default but it is not a valid backend package. Choose from:\n\t",
join(sort(_backends), "\n\t"))
end
catch
warn("You have set PLOTS_DEFAULT_BACKEND=$env_default but it is not installed.")
end
end
end
# the default if nothing else is installed
backend(:plotly)
for pkgstr in ("PyPlot", "Immerse", "Qwt", "Gadfly", "GR", "UnicodePlots", "Bokeh", "GLVisualize")
if Pkg.installed(pkgstr) != nothing
return backend(symbol(lowercase(pkgstr)))
end
end
# the default if nothing else is installed
backend(:plotly)
end

View File

@ -371,7 +371,7 @@ function _add_series(pkg::PyPlotBackend, plt::Plot, d::KW)
# cmap = get_cmap(plt, d)
dumpdict(d, "",true)
# dumpdict(d, "",true)
# handle zcolor and get c/cmap
# extra_kw = get_extra_kw(plt, d)