basic tuple implementation
This commit is contained in:
parent
7fb1a6a517
commit
7a521ef21f
@ -786,7 +786,6 @@ function processFillArg(plotattributes::KW, arg)
|
|||||||
plotattributes[:fillrange] = arg
|
plotattributes[:fillrange] = arg
|
||||||
|
|
||||||
elseif !handleColors!(plotattributes, arg, :fillcolor)
|
elseif !handleColors!(plotattributes, arg, :fillcolor)
|
||||||
|
|
||||||
plotattributes[:fillrange] = arg
|
plotattributes[:fillrange] = arg
|
||||||
end
|
end
|
||||||
# plotattributes[:fillrange] = fr
|
# plotattributes[:fillrange] = fr
|
||||||
|
|||||||
@ -191,6 +191,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
_pgfplotsx_series_ids[Symbol("$series_index")] = series_id
|
_pgfplotsx_series_ids[Symbol("$series_index")] = series_id
|
||||||
opt = series.plotattributes
|
opt = series.plotattributes
|
||||||
st = series[:seriestype]
|
st = series[:seriestype]
|
||||||
|
sf = series[:fillrange]
|
||||||
series_opt = PGFPlotsX.Options(
|
series_opt = PGFPlotsX.Options(
|
||||||
"color" => single_color(opt[:linecolor]),
|
"color" => single_color(opt[:linecolor]),
|
||||||
"name path" => string(series_id)
|
"name path" => string(series_id)
|
||||||
@ -200,7 +201,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
else
|
else
|
||||||
series_func = PGFPlotsX.Plot
|
series_func = PGFPlotsX.Plot
|
||||||
end
|
end
|
||||||
if series[:fillrange] !== nothing && !isfilledcontour(series) && series[:ribbon] === nothing
|
if sf !== nothing && !isfilledcontour(series) && series[:ribbon] === nothing
|
||||||
push!(series_opt, "area legend" => nothing)
|
push!(series_opt, "area legend" => nothing)
|
||||||
end
|
end
|
||||||
if st == :heatmap
|
if st == :heatmap
|
||||||
@ -243,9 +244,9 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
segment_opt = merge( segment_opt, pgfx_fillstyle(opt, i) )
|
segment_opt = merge( segment_opt, pgfx_fillstyle(opt, i) )
|
||||||
end
|
end
|
||||||
# add fillrange
|
# add fillrange
|
||||||
if series[:fillrange] !== nothing && !isfilledcontour(series) && series[:ribbon] === nothing
|
if sf !== nothing && !isfilledcontour(series) && series[:ribbon] === nothing
|
||||||
if series[:fillrange] == 0
|
if sf isa Number
|
||||||
pgfx_fillrange_series!( axis, series, series_func, i, _cycle(series[:fillrange], rng), rng)
|
pgfx_fillrange_series!( axis, series, series_func, i, _cycle(sf, rng), rng)
|
||||||
end
|
end
|
||||||
if i == 1 && opt[:label] != "" && sp[:legend] != :none && should_add_to_legend(series)
|
if i == 1 && opt[:label] != "" && sp[:legend] != :none && should_add_to_legend(series)
|
||||||
pgfx_filllegend!(series_opt, opt)
|
pgfx_filllegend!(series_opt, opt)
|
||||||
@ -260,10 +261,14 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
)
|
)
|
||||||
push!(axis, segment_plot)
|
push!(axis, segment_plot)
|
||||||
# fill between functions
|
# 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(
|
push!(axis, series_func(
|
||||||
merge(pgfx_fillstyle(opt, series_index), PGFPlotsX.Options("forget plot" => nothing)),
|
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
|
end
|
||||||
# add ribbons?
|
# add ribbons?
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const DataPoint = Union{MaybeNumber, MaybeString}
|
|||||||
|
|
||||||
prepareSeriesData(x) = error("Cannot convert $(typeof(x)) to series data for plotting")
|
prepareSeriesData(x) = error("Cannot convert $(typeof(x)) to series data for plotting")
|
||||||
prepareSeriesData(::Nothing) = nothing
|
prepareSeriesData(::Nothing) = nothing
|
||||||
|
prepareSeriesData(t::Tuple{T, T}) where {T<:Number} = t
|
||||||
prepareSeriesData(f::Function) = f
|
prepareSeriesData(f::Function) = f
|
||||||
prepareSeriesData(a::AbstractArray{<:MaybeNumber}) = replace!(
|
prepareSeriesData(a::AbstractArray{<:MaybeNumber}) = replace!(
|
||||||
x -> ismissing(x) || isinf(x) ? NaN : x,
|
x -> ismissing(x) || isinf(x) ? NaN : x,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user