Fix --> ignored in series recipes

This commit is contained in:
Andrew Palugniok 2018-08-26 12:11:44 +01:00
parent 91ec39e141
commit d3fdeeacce
3 changed files with 26 additions and 17 deletions

View File

@ -1536,7 +1536,13 @@ function _replace_linewidth(d::KW)
end
end
function _add_defaults!(d::KW, plt::Plot, sp::Subplot, commandIndex::Int)
function _slice_kw!(d::KW, commandIndex::Int)
for (k,v) in d
slice_arg!(d, d, k, v, commandIndex, false)
end
end
function _add_defaults!(d::KW, commandIndex::Int)
# add default values to our dictionary, being careful not to delete what we just added!
for (k,v) in _series_defaults
slice_arg!(d, d, k, v, commandIndex, false)

View File

@ -385,9 +385,9 @@ end
# this method recursively applies series recipes when the seriestype is not supported
# natively by the backend
function _process_seriesrecipe(plt::Plot, d::KW)
function _process_seriesrecipe(d::KW)
# replace seriestype aliases
st = Symbol(d[:seriestype])
st = Symbol(get(d, :seriestype, _series_defaults[:seriestype]))
st = d[:seriestype] = get(_typeAliases, st, st)
# shapes shouldn't have fillrange set
@ -395,14 +395,8 @@ function _process_seriesrecipe(plt::Plot, d::KW)
d[:fillrange] = nothing
end
# if it's natively supported, finalize processing and pass along to the backend, otherwise recurse
if is_seriestype_supported(st)
sp = _prepare_subplot(plt, d)
_prepare_annotations(sp, d)
_expand_subplot_extrema(sp, d, st)
_update_series_attributes!(d, plt, sp)
_add_the_series(plt, sp, d)
return nothing
else
# get a sub list of series for this seriestype
datalist = RecipesBase.apply_recipe(d, Val{st}, d[:x], d[:y], d[:z])
@ -414,7 +408,7 @@ function _process_seriesrecipe(plt::Plot, d::KW)
if data.d[:seriestype] == st
error("The seriestype didn't change in series recipe $st. This will cause a StackOverflow.")
end
_process_seriesrecipe(plt, data.d)
_process_seriesrecipe(data.d)
else
@warn("Unhandled recipe: $(data)")
break

View File

@ -119,7 +119,7 @@ function plot(plt1::Plot, plts_tail::Plot...; kw...)
sp.attr[:subplot_index] = idx
for series in serieslist
merge!(series.d, series_attr)
_add_defaults!(series.d, plt, sp, cmdidx)
_add_defaults!(series.d, cmdidx)
push!(plt.series_list, series)
_series_added(plt, series)
cmdidx += 1
@ -216,14 +216,13 @@ function _plot!(plt::Plot, d::KW, args::Tuple)
# map(DD, kw_list)
for kw in kw_list
sp::Subplot = kw[:subplot]
# idx = get_subplot_index(plt, sp)
# # we update subplot args in case something like the color palatte is part of the recipe
# _update_subplot_args(plt, sp, kw, idx, true)
# set default values, select from attribute cycles, and generally set the final attributes
_add_defaults!(kw, plt, sp, command_idx(kw_list,kw))
# select from attribute cycles
_slice_kw!(kw, command_idx(kw_list,kw))
# now we have a fully specified series, with colors chosen. we must recursively handle
# series recipes, which dispatch on seriestype. If a backend does not natively support a seriestype,
@ -231,7 +230,17 @@ function _plot!(plt::Plot, d::KW, args::Tuple)
# For example, a histogram is just a bar plot with binned data, a bar plot is really a filled step plot,
# and a step plot is really just a path. So any backend that supports drawing a path will implicitly
# be able to support step, bar, and histogram plots (and any recipes that use those components).
_process_seriesrecipe(plt, kw)
_process_seriesrecipe(kw)
# set default values, select from attribute cycles, and generally set the final attributes
_add_defaults!(kw, command_idx(kw_list,kw))
# finalize processing
sp = _prepare_subplot(plt, kw)
_prepare_annotations(sp, kw)
_expand_subplot_extrema(sp, kw, kw[:seriestype])
_update_series_attributes!(kw, plt, sp)
_add_the_series(plt, sp, kw)
end
# --------------------------------