Merge 4726463f1433aebbd344f0a8d9675d7a0669ec5e into 6dc0823b7392962dcbc684a2a57ff58d72076026

This commit is contained in:
Christopher Rackauckas 2018-08-12 06:01:33 +00:00 committed by GitHub
commit d97fc90fdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -11,7 +11,21 @@ const FuncOrFuncs{F} = Union{F, Vector{F}, Matrix{F}}
all3D(d::KW) = trueOrAllTrue(st -> st in (:contour, :contourf, :heatmap, :surface, :wireframe, :contour3d, :image, :plots_heatmap), get(d, :seriestype, :none)) all3D(d::KW) = trueOrAllTrue(st -> st in (:contour, :contourf, :heatmap, :surface, :wireframe, :contour3d, :image, :plots_heatmap), get(d, :seriestype, :none))
# unknown # unknown
convertToAnyVector(x, d::KW) = error("No user recipe defined for $(typeof(x))") # in this case, check if it's actually a callable type and use as a function
# otherwise it's unsupported and throw an error.
function convertToAnyVector(x, d::KW)
try
x(0.0)
catch
try
x(0.0,0.0)
catch
error("No user recipe defined for $(typeof(x))")
end
end
@show "here!"
Any[(v...)->x(v...)]
end
# missing # missing
convertToAnyVector(v::Nothing, d::KW) = Any[nothing], nothing convertToAnyVector(v::Nothing, d::KW) = Any[nothing], nothing

View File

@ -134,6 +134,13 @@ end
histogram([1, 0, 0, 0, 0, 0]) histogram([1, 0, 0, 0, 0, 0])
end end
@testset "Callable Functions" begin
struct MyFun end
(::MyFun)(x) = sin(x)
A = MyFun()
plot(A, -pi, pi, markershape = :circle)
end
# tests for preprocessing recipes # tests for preprocessing recipes
# @testset "recipes" begin # @testset "recipes" begin