plot recipe fixes

This commit is contained in:
Thomas Breloff 2016-06-18 22:30:47 -04:00
parent cf12ff8070
commit ea8ccf38db
2 changed files with 13 additions and 6 deletions

View File

@ -378,7 +378,7 @@ function _plot!(plt::Plot, d::KW, args...)
# "PLOT RECIPES"
# --------------------------------
# TODO: a new recipe type: "plot recipe", which acts like a series type, and is processed before
# "plot recipe", which acts like a series type, and is processed before
# the plot layout is created, which allows for setting layouts and other plot-wide attributes.
# we get inputs which have been fully processed by "user recipes" and "type recipes",
# so we can expect standard vectors, surfaces, etc. No defaults have been set yet.
@ -393,14 +393,19 @@ function _plot!(plt::Plot, d::KW, args...)
try
st = next_kw[:seriestype]
st = next_kw[:seriestype] = get(_typeAliases, st, st)
datalist = RecipesBase.apply_recipe(next_kw, Val{st})
info("processed $st $(length(datalist))")
datalist = RecipesBase.apply_recipe(next_kw, Val{st}, plt)
for data in datalist
push!(kw_list, data.d)
if data.d[:seriestype] == st
error("Plot recipe $st returned the same seriestype: $(data.d)")
end
push!(still_to_process, data.d)
end
catch err
@show err
push!(kw_list, next_kw)
if isa(err, MethodError)
push!(kw_list, next_kw)
else
rethrow()
end
end
end

View File

@ -111,6 +111,8 @@ num_series(x::AMat) = size(x,2)
num_series(x) = 1
RecipesBase.apply_recipe{T}(d::KW, ::Type{T}, plt::Plot) = throw(MethodError("Unmatched plot recipe: $T"))
# # if it's not a recipe, just do nothing and return the args
# function RecipesBase.apply_recipe(d::KW, args...; issubplot=false)
# if issubplot && !isempty(args) && !haskey(d, :n) && !haskey(d, :layout)