diff --git a/src/plot.jl b/src/plot.jl index 507f6cf6..6f17bb3e 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -162,8 +162,11 @@ end # this method recursively applies series recipes when the seriestype is not supported # natively by the backend function _apply_series_recipe(plt::Plot, d::KW) + # replace seriestype aliases st = d[:seriestype] - # @show st + st = d[:seriestype] = get(_typeAliases, st, st) + + # if it's natively supported, finalize processing and pass along to the backend, otherwise recurse if st in supported_types() # getting ready to add the series... last update to subplot from anything @@ -256,6 +259,24 @@ function _plot!(plt::Plot, d::KW, args...) args = (extractGroupArgs(d[:group], args...), args...) end + kw_list = KW[] + # still_to_process = isempty(args) ? [] : [RecipeData(copy(d), args)] + still_to_process = if isempty(args) + [] + else + # if we were passed a vector/matrix of series types and there's more than one row, + # we want to duplicate the inputs, once for each seriestype row. + sts = get(d, :seriestype, :path) + if typeof(sts) <: AbstractArray + [begin + dc = copy(d) + dc[:seriestype] = sts[r,:] + RecipeData(dc, args) + end for r=1:size(sts,1)] + else + [RecipeData(copy(d), args)] + end + end # for plotting recipes, swap out the args and update the parameter dictionary # we are keeping a queue of series that still need to be processed. @@ -263,8 +284,6 @@ function _plot!(plt::Plot, d::KW, args...) # the recipe will return a list a Series objects... the ones that are # finished (no more args) get added to the kw_list, and the rest go into the queue # for processing. - kw_list = KW[] - still_to_process = isempty(args) ? [] : [RecipeData(copy(d), args)] while !isempty(still_to_process) # grab the first in line to be processed and pass it through apply_recipe @@ -409,12 +428,13 @@ function _plot!(plt::Plot, d::KW, args...) # get the Subplot object to which the series belongs sp = get(kw, :subplot, :auto) command_idx = kw[:series_plotindex] - kw_list[1][:series_plotindex] + 1 - sp = if sp == :auto - cycle(plt.subplots, command_idx) - # mod1(command_idx, length(plt.subplots)) - else - slice_arg(sp, command_idx) - end + sp = cycle(sp==:auto ? plt.subplots : sp, command_idx) + # sp = if sp == :auto + # cycle(plt.subplots, command_idx) + # # mod1(command_idx, length(plt.subplots)) + # else + # cycle(sp, command_idx) + # end sp = kw[:subplot] = get_subplot(plt, sp) # idx = get_subplot_index(plt, sp) attr = KW() diff --git a/src/recipes.jl b/src/recipes.jl index a182e002..6c0d02cd 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -214,8 +214,20 @@ end # end # @deps sticks path +function hvline_limits(axis::Axis) + vmin, vmax = axis_limits(axis) + if vmin >= vmax + if isfinite(vmin) + vmax = vmin + 1 + else + vmin, vmax = 0.0, 1.1 + end + end + vmin, vmax +end + @recipe function f(::Type{Val{:hline}}, x, y, z) - xmin, xmax = axis_limits(d[:subplot][:xaxis]) + xmin, xmax = hvline_limits(d[:subplot][:xaxis]) n = length(y) newx = repmat(Float64[xmin, xmax, NaN], n) newy = vec(Float64[yi for i=1:3,yi=y]) @@ -227,7 +239,7 @@ end @deps hline path @recipe function f(::Type{Val{:vline}}, x, y, z) - ymin, ymax = axis_limits(d[:subplot][:yaxis]) + ymin, ymax = hvline_limits(d[:subplot][:yaxis]) n = length(y) newx = vec(Float64[yi for i=1:3,yi=y]) newy = repmat(Float64[ymin, ymax, NaN], n) diff --git a/src/utils.jl b/src/utils.jl index a0009d64..c4e283d8 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -189,6 +189,9 @@ end nop() = nothing notimpl() = error("This has not been implemented yet") +Base.cycle(wrapper::InputWrapper, idx::Int) = wrapper.obj +Base.cycle(wrapper::InputWrapper, idx::AVec{Int}) = wrapper.obj + Base.cycle(v::AVec, idx::Int) = v[mod1(idx, length(v))] Base.cycle(v::AMat, idx::Int) = size(v,1) == 1 ? v[1, mod1(idx, size(v,2))] : v[:, mod1(idx, size(v,2))] Base.cycle(v, idx::Int) = v diff --git a/test/runtests.jl b/test/runtests.jl index 7caeb2ce..b320bed4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -30,7 +30,7 @@ facts("GR") do @fact gr() --> Plots.GRBackend() @fact backend() --> Plots.GRBackend() - @linux_only image_comparison_facts(:gr, skip=[30], eps=img_eps) + image_comparison_facts(:gr, skip=[30], eps=img_eps) end facts("Plotly") do