From 503d741ea65322417f89c51c5bf6c4d1f5a6a7de Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Fri, 13 Mar 2020 19:26:45 +0530 Subject: [PATCH 1/2] move tryrange to PlotUtils --- src/series.jl | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/series.jl b/src/series.jl index bba2f313..8fb51b15 100644 --- a/src/series.jl +++ b/src/series.jl @@ -388,32 +388,14 @@ end axis_limits(plt[1], :x) catch xinv = invscalefunc(get(plotattributes, :xscale, :identity)) - xm = tryrange(f, xinv.([-5,-1,0,0.01])) - xm, tryrange(f, filter(x->x>xm, xinv.([5,1,0.99, 0, -0.01]))) + xm = PlotUtils.tryrange(f, xinv.([-5,-1,0,0.01])) + xm, PlotUtils.tryrange(f, filter(x->x>xm, xinv.([5,1,0.99, 0, -0.01]))) end end f, xmin, xmax end -# try some intervals over which the function may be defined -function tryrange(F::AbstractArray, vec) - rets = [tryrange(f, vec) for f in F] # get the preferred for each - maxind = maximum(indexin(rets, vec)) # get the last attempt that succeeded (most likely to fit all) - rets .= [tryrange(f, vec[maxind:maxind]) for f in F] # ensure that all functions compute there - rets[1] -end - -function tryrange(F, vec) - for v in vec - try - tmp = F(v) - return v - catch - end - end - error("$F is not a Function, or is not defined at any of the values $vec") -end # # # -------------------------------------------------------------------- # # 2 arguments From edcaab3c56416f3fb0a9f362d620ec6052634e8e Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Sat, 14 Mar 2020 11:03:23 +0530 Subject: [PATCH 2/2] bump the PlotUtils compat this will only work after a release --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 00c034e9..2f2df781 100644 --- a/Project.toml +++ b/Project.toml @@ -41,7 +41,7 @@ Measures = "0.3" NaNMath = "0.3" PGFPlotsX = "1.2.0" PlotThemes = "1" -PlotUtils = "0.6.1" +PlotUtils = "0.6.5" RecipesBase = "0.8" Reexport = "0.2" Requires = "0.5, 1.0"