Merge pull request #2051 from yha/first-missing

Fix for missing as first element
This commit is contained in:
Michael Krabbe Borregaard 2019-06-04 20:47:10 +02:00 committed by GitHub
commit 1543c77a39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -193,8 +193,9 @@ _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(v) && return Float64[]
args = RecipesBase.apply_recipe(plotattributes, typeof(v[1]), v[1])[1].args
isempty(skipmissing(v)) && return Float64[]
x = first(skipmissing(v))
args = RecipesBase.apply_recipe(plotattributes, typeof(x), x)[1].args
if length(args) == 2 && typeof(args[1]) <: Function && typeof(args[2]) <: Function
numfunc, formatter = args
Formatted(map(numfunc, v), formatter)