skeleton
This commit is contained in:
parent
dd70192de4
commit
80903a2789
@ -94,6 +94,8 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
)
|
||||
))
|
||||
end
|
||||
inset_subplots = plt.inset_subplots
|
||||
parents = getproperty.(inset_subplots, :parent)
|
||||
for sp in plt.subplots
|
||||
bb = bbox(sp)
|
||||
sp_width = width(bb)
|
||||
@ -186,22 +188,17 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
axis_opt
|
||||
)
|
||||
for (series_index, series) in enumerate(series_list(sp))
|
||||
# give each series a uuid for fillbetween
|
||||
series_id = uuid4()
|
||||
_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)
|
||||
)
|
||||
if is3d(series) || st == :heatmap
|
||||
series_func = PGFPlotsX.Plot3
|
||||
else
|
||||
series_func = PGFPlotsX.Plot
|
||||
end
|
||||
if sf !== nothing && !isfilledcontour(series) && series[:ribbon] === nothing
|
||||
if series[:fillrange] !== nothing && !isfilledcontour(series) && series[:ribbon] === nothing
|
||||
push!(series_opt, "area legend" => nothing)
|
||||
end
|
||||
if st == :heatmap
|
||||
@ -244,10 +241,8 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
segment_opt = merge( segment_opt, pgfx_fillstyle(opt, i) )
|
||||
end
|
||||
# add fillrange
|
||||
if sf !== nothing && !isfilledcontour(series) && series[:ribbon] === nothing
|
||||
if sf isa Number || sf isa AVec
|
||||
pgfx_fillrange_series!( axis, series, series_func, i, _cycle(sf, rng), rng)
|
||||
end
|
||||
if series[:fillrange] !== nothing && !isfilledcontour(series) && series[:ribbon] === nothing
|
||||
pgfx_fillrange_series!( axis, series, series_func, i, _cycle(series[:fillrange], rng), rng)
|
||||
if i == 1 && opt[:label] != "" && sp[:legend] != :none && should_add_to_legend(series)
|
||||
pgfx_filllegend!(series_opt, opt)
|
||||
end
|
||||
@ -260,15 +255,6 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
coordinates,
|
||||
)
|
||||
push!(axis, segment_plot)
|
||||
# fill between functions
|
||||
if sf isa Tuple && series[:ribbon] === nothing
|
||||
sf1, sf2 = sf
|
||||
@assert sf1 == series_index "First index of the tuple has to match the current 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(sf2))])]"
|
||||
))
|
||||
end
|
||||
# add ribbons?
|
||||
ribbon = series[:ribbon]
|
||||
if ribbon !== nothing
|
||||
@ -290,26 +276,36 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
end
|
||||
end
|
||||
# add subplot annotations
|
||||
for ann in sp[:annotations]
|
||||
pgfx_add_annotation!(axis, locate_annotation(sp, ann...)..., pgfx_thickness_scaling(sp))
|
||||
anns = sp.attr[:annotations]
|
||||
for (xi,yi,txt) in anns
|
||||
pgfx_add_annotation!(axis, xi, yi, txt, pgfx_thickness_scaling(sp))
|
||||
end
|
||||
end
|
||||
# anns = sp.attr[:annotations]
|
||||
# for (xi,yi,txt) in anns
|
||||
# pgfx_add_annotation!(axis, xi, yi, txt, pgfx_thickness_scaling(sp))
|
||||
# end
|
||||
end # for series
|
||||
if ispolar(sp)
|
||||
axes = the_plot
|
||||
else
|
||||
axes = the_plot.elements[1]
|
||||
end
|
||||
##< handle insets
|
||||
# TODO: build id map for subplots like for series
|
||||
if sp in parents
|
||||
sp_id = uuid4()
|
||||
push!(axis, "\\coordinate ($sp_id) at (rel axis cs:$())") # TODO: compute rel coordinates from bboxes
|
||||
end
|
||||
if sp in inset_subplots
|
||||
push!(axis.options, PGFPlotsX.Options(
|
||||
"at" => "($())", # TODO: insert correct ID here
|
||||
"anchor" => "outer south west", # TODO: check this
|
||||
))
|
||||
end
|
||||
##>
|
||||
push!( axes, axis )
|
||||
if length(plt.o.the_plot.elements) > 0
|
||||
plt.o.the_plot.elements[1] = the_plot
|
||||
else
|
||||
push!(plt.o, the_plot)
|
||||
end
|
||||
end # for subplots
|
||||
end
|
||||
pgfx_plot.is_created = true
|
||||
end # if
|
||||
return pgfx_plot
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user