pyplot figure finalizer; accept 2-len AVec for limits (#289); sleep/skip/only options in test_examples
This commit is contained in:
parent
2dd480a3a6
commit
3b325b2482
@ -229,7 +229,7 @@ function axis_limits(axis::Axis, should_widen::Bool = default_should_widen(axis)
|
|||||||
ex = axis[:extrema]
|
ex = axis[:extrema]
|
||||||
amin, amax = ex.emin, ex.emax
|
amin, amax = ex.emin, ex.emax
|
||||||
lims = axis[:lims]
|
lims = axis[:lims]
|
||||||
if isa(lims, Tuple) && length(lims) == 2
|
if (isa(lims, Tuple) || isa(lims, AVec)) && length(lims) == 2
|
||||||
if isfinite(lims[1])
|
if isfinite(lims[1])
|
||||||
amin = lims[1]
|
amin = lims[1]
|
||||||
end
|
end
|
||||||
|
|||||||
@ -348,6 +348,7 @@ function _create_backend_figure(plt::Plot{PyPlotBackend})
|
|||||||
PyPlot.gcf()
|
PyPlot.gcf()
|
||||||
else
|
else
|
||||||
PyPlot.figure()
|
PyPlot.figure()
|
||||||
|
finalizer(fig, close)
|
||||||
end
|
end
|
||||||
|
|
||||||
# clear the figure
|
# clear the figure
|
||||||
|
|||||||
@ -325,11 +325,13 @@ function test_examples(pkgname::Symbol, idx::Int; debug = false, disp = true)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# generate all plots and create a dict mapping idx --> plt
|
# generate all plots and create a dict mapping idx --> plt
|
||||||
function test_examples(pkgname::Symbol; debug = false, disp = true)
|
function test_examples(pkgname::Symbol; debug = false, disp = true, sleep = nothing,
|
||||||
|
skip = [], only = nothing)
|
||||||
Plots._debugMode.on = debug
|
Plots._debugMode.on = debug
|
||||||
plts = Dict()
|
plts = Dict()
|
||||||
for i in 1:length(_examples)
|
for i in 1:length(_examples)
|
||||||
|
only != nothing && !(i in only) && continue
|
||||||
|
i in skip && continue
|
||||||
try
|
try
|
||||||
plt = test_examples(pkgname, i, debug=debug, disp=disp)
|
plt = test_examples(pkgname, i, debug=debug, disp=disp)
|
||||||
plts[i] = plt
|
plts[i] = plt
|
||||||
@ -337,6 +339,9 @@ function test_examples(pkgname::Symbol; debug = false, disp = true)
|
|||||||
# TODO: put error info into markdown?
|
# TODO: put error info into markdown?
|
||||||
warn("Example $pkgname:$i:$(_examples[i].header) failed with: $ex")
|
warn("Example $pkgname:$i:$(_examples[i].header) failed with: $ex")
|
||||||
end
|
end
|
||||||
|
if sleep != nothing
|
||||||
|
Base.sleep(sleep)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
plts
|
plts
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user