added _apply_recipe

This commit is contained in:
Thomas Breloff 2015-11-24 10:45:49 -05:00
parent cdb4901d91
commit cdc7920dff
3 changed files with 14 additions and 3 deletions

View File

@ -79,6 +79,9 @@ function plot!(plt::Plot, args...; kw...)
d = Dict(kw)
preprocessArgs!(d)
# for plotting recipes, swap out the args and update the parameter dictionary
args = _apply_recipe(d, args...; kw...)
dumpdict(d, "After plot! preprocessing")
warnOnUnsupportedArgs(plt.backend, d)
@ -393,7 +396,7 @@ end
# special handling... xmin/xmax with function(s)
function createKWargsList(plt::PlottingObject, f::FuncOrFuncs, xmin::Real, xmax::Real; kw...)
width = plt.plotargs[:size][1]
width = get(plt.plotargs, :size, (100,))[1]
x = collect(linspace(xmin, xmax, width)) # we don't need more than the width
createKWargsList(plt, x, f; kw...)
end

View File

@ -14,6 +14,8 @@ plot(recipe::PlotRecipe, args...; kw...) = plot(getRecipeXY(recipe)..., args...;
plot!(recipe::PlotRecipe, args...; kw...) = plot!(getRecipeXY(recipe)..., args...; getRecipeArgs(recipe)..., kw...)
plot!(plt::Plot, recipe::PlotRecipe, args...; kw...) = plot!(getRecipeXY(recipe)..., args...; getRecipeArgs(recipe)..., kw...)
# if it's not a recipe, just do nothing and return the args
_apply_recipe(d::Dict, args...; kw...) = args
# # -------------------------------------------------

View File

@ -220,9 +220,13 @@ end
# ------------------------------------------------------------------------------------------------
function _preprocess_subplot(subplt::Subplot, d::Dict)
function _preprocess_subplot(subplt::Subplot, d::Dict, args = ())
validateSubplotSupported()
preprocessArgs!(d)
# for plotting recipes, swap out the args and update the parameter dictionary
args = _apply_recipe(d, args...; d...)
dumpdict(d, "After subplot! preprocessing")
# get the full plotargs, overriding any new settings
@ -246,6 +250,8 @@ function _preprocess_subplot(subplt::Subplot, d::Dict)
delete!(d, s)
end
end
args
end
function _postprocess_subplot(subplt::Subplot, d::Dict)
@ -295,7 +301,7 @@ function subplot!(subplt::Subplot, args...; kw...)
# validateSubplotSupported()
d = Dict(kw)
_preprocess_subplot(subplt, d)
args = _preprocess_subplot(subplt, d, args)
# create the underlying object (each backend will do this differently)
# note: we call it once before doing the individual plots, and once after