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.",
|
"A simple line plot of the 3 columns.",
|
||||||
[:(plot(rand(100,3)))]),
|
[:(plot(rand(100,3)))]),
|
||||||
PlotExample("Functions",
|
PlotExample("Functions",
|
||||||
"Plot multiple functions",
|
"Plot multiple functions.",
|
||||||
[:(plot(0:0.01:4π, [sin,cos]))]),
|
[:(plot(0:0.01:4π, [sin,cos]))]),
|
||||||
|
PlotExample("",
|
||||||
|
"You can also call it with (xmin, xmax).",
|
||||||
|
[:(plot([sin,cos], 0, 4π))]),
|
||||||
PlotExample("Global",
|
PlotExample("Global",
|
||||||
"Change the guides/background without a separate call.",
|
"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)))]),
|
[:(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)
|
if !(currentPackageSymbol in INITIALIZED_PACKAGES)
|
||||||
|
|
||||||
# initialize
|
# initialize
|
||||||
print("[Plots.jl] Initializing package: $CURRENT_PACKAGE... ")
|
println("[Plots.jl] Initializing package: $CURRENT_PACKAGE... ")
|
||||||
if currentPackageSymbol == :qwt
|
if currentPackageSymbol == :qwt
|
||||||
@eval import 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
|
elseif currentPackageSymbol == :gadfly
|
||||||
@eval import Gadfly
|
try
|
||||||
|
@eval import Gadfly
|
||||||
|
catch
|
||||||
|
error("Couldn't import Gadfly. Install it with: Pkg.add(\"Gadfly\")")
|
||||||
|
end
|
||||||
elseif currentPackageSymbol == :unicodeplots
|
elseif currentPackageSymbol == :unicodeplots
|
||||||
@eval import UnicodePlots
|
try
|
||||||
|
@eval import UnicodePlots
|
||||||
|
catch
|
||||||
|
error("Couldn't import UnicodePlots. Install it with: Pkg.add(\"UnicodePlots\")")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
error("Unknown plotter $currentPackageSymbol. Choose from: $AVAILABLE_PACKAGES")
|
error("Unknown plotter $currentPackageSymbol. Choose from: $AVAILABLE_PACKAGES")
|
||||||
end
|
end
|
||||||
push!(INITIALIZED_PACKAGES, currentPackageSymbol)
|
push!(INITIALIZED_PACKAGES, currentPackageSymbol)
|
||||||
println("done.")
|
println("[Plots.jl] done.")
|
||||||
|
|
||||||
end
|
end
|
||||||
CURRENT_PACKAGE.pkg
|
CURRENT_PACKAGE.pkg
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user