reverse type recipe order

This commit is contained in:
Daniel Schwabeneder 2020-03-18 01:23:46 +01:00
parent 3ed50bbf0f
commit 89e271bd91

View File

@ -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, # This sort of recipe should return a pair of functions... one to convert to number,
# and one to format tick values. # and one to format tick values.
function _apply_type_recipe(plotattributes, v::AbstractArray) function _apply_type_recipe(plotattributes, v::AbstractArray)
isempty(skipmissing(v)) && return Float64[] # First we try to apply an array type recipe.
x = first(skipmissing(v)) w = RecipesBase.apply_recipe(plotattributes, typeof(v), v)[1].args[1]
args = RecipesBase.apply_recipe(plotattributes, typeof(x), x)[1].args # If the type did not change try it element-wise
if length(args) == 2 && all(arg -> arg isa Function, args) if v == w
numfunc, formatter = args isempty(skipmissing(v)) && return Float64[]
Formatted(map(numfunc, v), formatter) x = first(skipmissing(v))
else args = RecipesBase.apply_recipe(plotattributes, typeof(x), x)[1].args
RecipesBase.apply_recipe(plotattributes, typeof(v), v)[1].args[1] if length(args) == 2 && all(arg -> arg isa Function, args)
numfunc, formatter = args
return Formatted(map(numfunc, v), formatter)
end
end end
return w
end end
# # special handling for Surface... need to properly unwrap and re-wrap # # special handling for Surface... need to properly unwrap and re-wrap