better error when importing a package that is not installed; xmin/xmax functions example
This commit is contained in:
parent
4299aa0ff8
commit
7fb1a4ec0f
@ -23,8 +23,11 @@ const examples = PlotExample[
|
||||
"A simple line plot of the 3 columns.",
|
||||
[:(plot(rand(100,3)))]),
|
||||
PlotExample("Functions",
|
||||
"Plot multiple functions",
|
||||
"Plot multiple functions.",
|
||||
[:(plot(0:0.01:4π, [sin,cos]))]),
|
||||
PlotExample("",
|
||||
"You can also call it with (xmin, xmax).",
|
||||
[:(plot([sin,cos], 0, 4π))]),
|
||||
PlotExample("Global",
|
||||
"Change the guides/background without a separate call.",
|
||||
[:(plot(rand(10); title="TITLE", xlabel="XLABEL", ylabel="YLABEL", background_color = RGB(0.5,0.5,0.5)))]),
|
||||
|
||||
@ -34,18 +34,30 @@ function plotter()
|
||||
if !(currentPackageSymbol in INITIALIZED_PACKAGES)
|
||||
|
||||
# initialize
|
||||
print("[Plots.jl] Initializing package: $CURRENT_PACKAGE... ")
|
||||
println("[Plots.jl] Initializing package: $CURRENT_PACKAGE... ")
|
||||
if currentPackageSymbol == :qwt
|
||||
try
|
||||
@eval import Qwt
|
||||
catch
|
||||
error("Couldn't import Qwt. Install it with: Pkg.clone(\"https://github.com/tbreloff/Qwt.jl.git\")\n (Note: also requires pyqt and pyqwt)")
|
||||
end
|
||||
elseif currentPackageSymbol == :gadfly
|
||||
try
|
||||
@eval import Gadfly
|
||||
catch
|
||||
error("Couldn't import Gadfly. Install it with: Pkg.add(\"Gadfly\")")
|
||||
end
|
||||
elseif currentPackageSymbol == :unicodeplots
|
||||
try
|
||||
@eval import UnicodePlots
|
||||
catch
|
||||
error("Couldn't import UnicodePlots. Install it with: Pkg.add(\"UnicodePlots\")")
|
||||
end
|
||||
else
|
||||
error("Unknown plotter $currentPackageSymbol. Choose from: $AVAILABLE_PACKAGES")
|
||||
end
|
||||
push!(INITIALIZED_PACKAGES, currentPackageSymbol)
|
||||
println("done.")
|
||||
println("[Plots.jl] done.")
|
||||
|
||||
end
|
||||
CURRENT_PACKAGE.pkg
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user