pyplot log scale threshold fix; imgcomp fix to filter out higher versions

This commit is contained in:
Thomas Breloff 2016-06-12 13:06:15 -04:00
parent 02d893b316
commit 5bb9aceaac
2 changed files with 26 additions and 13 deletions

View File

@ -915,21 +915,32 @@ function py_set_ticks(ax, ticks, letter)
end end
end end
function py_set_scale(ax, scaleType::Symbol, letter) function py_compute_axis_minval(axis::Axis)
scaleType in supported_scales() || return warn("Unhandled scale value in pyplot: $scaleType") minval = 1.0
sp = axis.sp
for series in series_list(axis.sp)
minval = min(minval, minimum(abs(series.d[axis[:letter]])))
end
minval
end
function py_set_scale(ax, axis::Axis)
scale = axis[:scale]
letter = axis[:letter]
scale in supported_scales() || return warn("Unhandled scale value in pyplot: $scale")
func = ax[Symbol("set_", letter, "scale")] func = ax[Symbol("set_", letter, "scale")]
kw = KW() kw = KW()
arg = if scaleType == :identity arg = if scale == :identity
"linear" "linear"
else else
kw[Symbol(:base,letter)] = if scaleType == :ln kw[Symbol(:base,letter)] = if scale == :ln
e e
elseif scaleType == :log2 elseif scale == :log2
2 2
elseif scaleType == :log10 elseif scale == :log10
10 10
end end
# kw[Symbol(:linthresh,letter)] = 1e-16 kw[Symbol(:linthresh,letter)] = max(1e-16, py_compute_axis_minval(axis))
"symlog" "symlog"
end end
func(arg; kw...) func(arg; kw...)
@ -998,7 +1009,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
axissym = Symbol(letter, :axis) axissym = Symbol(letter, :axis)
axis = sp[axissym] axis = sp[axissym]
haskey(ax, axissym) || continue haskey(ax, axissym) || continue
py_set_scale(ax, axis[:scale], letter) py_set_scale(ax, axis)
py_set_lims(ax, axis) py_set_lims(ax, axis)
py_set_ticks(ax, get_ticks(axis), letter) py_set_ticks(ax, get_ticks(axis), letter)
ax[Symbol("set_", letter, "label")](axis[:guide]) ax[Symbol("set_", letter, "label")](axis[:guide])

View File

@ -45,17 +45,19 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = is
# @show refdir fn G # @show refdir fn G
versions = map(fn -> VersionNumber(split(fn,"/")[end]), G) versions = map(fn -> VersionNumber(split(fn,"/")[end]), G)
versions = reverse(sort(versions)) versions = reverse(sort(versions))
versions = filter(v -> v <= _current_plots_version, versions)
# @show refdir fn versions # @show refdir fn versions
reffn = nothing
newdir = joinpath(refdir, string(_current_plots_version)) newdir = joinpath(refdir, string(_current_plots_version))
newfn = joinpath(newdir, fn) newfn = joinpath(newdir, fn)
# figure out which reference file we should compare to, by finding the highest versioned file
reffn = nothing
for v in versions for v in versions
try tmpfn = joinpath(refdir, string(v), fn)
tmpfn = joinpath(refdir, string(v), fn) if isfile(tmpfn)
# @show "trying", tmpfn
f = open(tmpfn)
reffn = tmpfn reffn = tmpfn
break
end end
end end