From 89e271bd912187e5193e670b28129bd124fa04e5 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Wed, 18 Mar 2020 01:23:46 +0100 Subject: [PATCH] reverse type recipe order --- src/series.jl | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/series.jl b/src/series.jl index 4f66da77..edc1053b 100644 --- a/src/series.jl +++ b/src/series.jl @@ -178,15 +178,19 @@ _apply_type_recipe(plotattributes, v) = RecipesBase.apply_recipe(plotattributes, # This sort of recipe should return a pair of functions... one to convert to number, # and one to format tick values. function _apply_type_recipe(plotattributes, v::AbstractArray) - isempty(skipmissing(v)) && return Float64[] - x = first(skipmissing(v)) - args = RecipesBase.apply_recipe(plotattributes, typeof(x), x)[1].args - if length(args) == 2 && all(arg -> arg isa Function, args) - numfunc, formatter = args - Formatted(map(numfunc, v), formatter) - else - RecipesBase.apply_recipe(plotattributes, typeof(v), v)[1].args[1] + # First we try to apply an array type recipe. + w = RecipesBase.apply_recipe(plotattributes, typeof(v), v)[1].args[1] + # If the type did not change try it element-wise + if v == w + isempty(skipmissing(v)) && return Float64[] + x = first(skipmissing(v)) + args = RecipesBase.apply_recipe(plotattributes, typeof(x), x)[1].args + if length(args) == 2 && all(arg -> arg isa Function, args) + numfunc, formatter = args + return Formatted(map(numfunc, v), formatter) + end end + return w end # # special handling for Surface... need to properly unwrap and re-wrap