working on org/docs/test
This commit is contained in:
parent
d27e6dc29e
commit
172688fb99
@ -11,8 +11,6 @@ using Requires
|
||||
|
||||
abstract PlottingPackage
|
||||
|
||||
immutable QwtPackage <: PlottingPackage end
|
||||
immutable GadflyPackage <: PlottingPackage end
|
||||
|
||||
const AVAILABLE_PACKAGES = [:Qwt, :Gadfly]
|
||||
const INITIALIZED_PACKAGES = Set{Symbol}()
|
||||
@ -35,7 +33,8 @@ Setup the plot environment.
|
||||
Same for `plotter(:Gadfly)`, etc.
|
||||
"""
|
||||
function plotter(modname)
|
||||
if modname == :Qwt
|
||||
|
||||
if modname in (:Qwt, :qwt)
|
||||
if !(modname in INITIALIZED_PACKAGES)
|
||||
qwt()
|
||||
push!(INITIALIZED_PACKAGES, modname)
|
||||
@ -43,7 +42,8 @@ function plotter(modname)
|
||||
global Qwt = Main.Qwt
|
||||
CURRENT_PACKAGE.pkg = Nullable(QwtPackage())
|
||||
return
|
||||
elseif modname == :Gadfly
|
||||
|
||||
elseif modname in (:Gadfly, :gadfly)
|
||||
if !(modname in INITIALIZED_PACKAGES)
|
||||
gadfly()
|
||||
push!(INITIALIZED_PACKAGES, modname)
|
||||
@ -51,6 +51,7 @@ function plotter(modname)
|
||||
global Gadfly = Main.Gadfly
|
||||
CURRENT_PACKAGE.pkg = Nullable(GadflyPackage())
|
||||
return
|
||||
|
||||
end
|
||||
error("Unknown plotter $modname. Choose from: $AVAILABLE_PACKAGES")
|
||||
end
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
|
||||
# Gadfly
|
||||
# https://github.com/dcjones/Gadfly.jl
|
||||
|
||||
immutable GadflyPackage <: PlottingPackage end
|
||||
|
||||
plot(::GadflyPackage, y; kw...) = Gadfly.plot(; x = 1:length(y), y = y, kw...)
|
||||
plot(::GadflyPackage, x, y; kw...) = Gadfly.plot(; x = x, y = y, kw...)
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
|
||||
# Qwt
|
||||
# https://github.com/tbreloff/Qwt.jl
|
||||
|
||||
immutable QwtPackage <: PlottingPackage end
|
||||
|
||||
plot(::QwtPackage, args...; kw...) = Qwt.plot(args...; kw...)
|
||||
subplot(::QwtPackage, args...; kw...) = Qwt.subplot(args...; kw...)
|
||||
|
||||
@ -5,7 +5,11 @@ using FactCheck
|
||||
|
||||
|
||||
facts("Qwt") do
|
||||
@fact plotter(:qwt) --> nothing
|
||||
end
|
||||
|
||||
facts("Gadfly") do
|
||||
@fact plotter(:gadfly) --> nothing
|
||||
end
|
||||
|
||||
end # module
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user