diff --git a/src/args.jl b/src/args.jl index 75577482..a6f0f41d 100644 --- a/src/args.jl +++ b/src/args.jl @@ -786,7 +786,6 @@ function processFillArg(plotattributes::KW, arg) plotattributes[:fillrange] = arg elseif !handleColors!(plotattributes, arg, :fillcolor) - plotattributes[:fillrange] = arg end # plotattributes[:fillrange] = fr diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index 99b52c8e..4c060436 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -191,6 +191,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend}) _pgfplotsx_series_ids[Symbol("$series_index")] = series_id opt = series.plotattributes st = series[:seriestype] + sf = series[:fillrange] series_opt = PGFPlotsX.Options( "color" => single_color(opt[:linecolor]), "name path" => string(series_id) @@ -200,7 +201,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend}) else series_func = PGFPlotsX.Plot end - if series[:fillrange] !== nothing && !isfilledcontour(series) && series[:ribbon] === nothing + if sf !== nothing && !isfilledcontour(series) && series[:ribbon] === nothing push!(series_opt, "area legend" => nothing) end if st == :heatmap @@ -243,9 +244,9 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend}) segment_opt = merge( segment_opt, pgfx_fillstyle(opt, i) ) end # add fillrange - if series[:fillrange] !== nothing && !isfilledcontour(series) && series[:ribbon] === nothing - if series[:fillrange] == 0 - pgfx_fillrange_series!( axis, series, series_func, i, _cycle(series[:fillrange], rng), rng) + if sf !== nothing && !isfilledcontour(series) && series[:ribbon] === nothing + if sf isa Number + pgfx_fillrange_series!( axis, series, series_func, i, _cycle(sf, rng), rng) end if i == 1 && opt[:label] != "" && sp[:legend] != :none && should_add_to_legend(series) pgfx_filllegend!(series_opt, opt) @@ -260,10 +261,14 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend}) ) push!(axis, segment_plot) # fill between functions - if series[:fillrange] !== nothing && series[:fillrange] != 0 + @show sf + @show series[:fillcolor] + if sf isa Tuple + sf1, sf2 = sf + @assert sf1 == series_index push!(axis, series_func( merge(pgfx_fillstyle(opt, series_index), PGFPlotsX.Options("forget plot" => nothing)), - "fill between [of=$series_id and $(_pgfplotsx_series_ids[Symbol(string(series[:fillrange]))])]" + "fill between [of=$series_id and $(_pgfplotsx_series_ids[Symbol(string(sf2))])]" )) end # add ribbons? diff --git a/src/series.jl b/src/series.jl index be5fc439..88e89b26 100644 --- a/src/series.jl +++ b/src/series.jl @@ -13,6 +13,7 @@ const DataPoint = Union{MaybeNumber, MaybeString} prepareSeriesData(x) = error("Cannot convert $(typeof(x)) to series data for plotting") prepareSeriesData(::Nothing) = nothing +prepareSeriesData(t::Tuple{T, T}) where {T<:Number} = t prepareSeriesData(f::Function) = f prepareSeriesData(a::AbstractArray{<:MaybeNumber}) = replace!( x -> ismissing(x) || isinf(x) ? NaN : x,