diff --git a/src/plot.jl b/src/plot.jl index 5f392639..116835c8 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -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 diff --git a/src/recipes.jl b/src/recipes.jl index 4ea5845c..6b6090ee 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -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 # # ------------------------------------------------- diff --git a/src/subplot.jl b/src/subplot.jl index b8931374..5fc04a10 100644 --- a/src/subplot.jl +++ b/src/subplot.jl @@ -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