working insets, fix background opacity
This commit is contained in:
parent
b222ab71a9
commit
5b628bf48d
@ -98,6 +98,8 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
inset_subplots = plt.inset_subplots
|
inset_subplots = plt.inset_subplots
|
||||||
parents = getproperty.(inset_subplots, :parent)
|
parents = getproperty.(inset_subplots, :parent)
|
||||||
for sp in plt.subplots
|
for sp in plt.subplots
|
||||||
|
sp_id = uuid4()
|
||||||
|
_pgfplotsx_subplot_ids[Symbol("$(sp[:subplot_index])")] = sp_id
|
||||||
bb = bbox(sp)
|
bb = bbox(sp)
|
||||||
sp_width = width(bb)
|
sp_width = width(bb)
|
||||||
sp_height = height(bb)
|
sp_height = height(bb)
|
||||||
@ -106,6 +108,8 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
fg_alpha = alpha(plot_color(sp[:foreground_color_legend]))
|
fg_alpha = alpha(plot_color(sp[:foreground_color_legend]))
|
||||||
title_cstr = plot_color(sp[:titlefontcolor])
|
title_cstr = plot_color(sp[:titlefontcolor])
|
||||||
title_a = alpha(title_cstr)
|
title_a = alpha(title_cstr)
|
||||||
|
bgc_inside = plot_color(sp[:background_color_inside])
|
||||||
|
bgc_inside_a = alpha(bgc_inside)
|
||||||
axis_opt = PGFPlotsX.Options(
|
axis_opt = PGFPlotsX.Options(
|
||||||
"title" => sp[:title],
|
"title" => sp[:title],
|
||||||
"title style" => PGFPlotsX.Options(
|
"title style" => PGFPlotsX.Options(
|
||||||
@ -122,9 +126,11 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
"font" => pgfx_font(sp[:legendfontsize], pgfx_thickness_scaling(sp))
|
"font" => pgfx_font(sp[:legendfontsize], pgfx_thickness_scaling(sp))
|
||||||
),
|
),
|
||||||
"axis background/.style" => PGFPlotsX.Options(
|
"axis background/.style" => PGFPlotsX.Options(
|
||||||
"fill" => sp[:background_color_inside]
|
"fill" => bgc_inside,
|
||||||
|
"opacity" => bgc_inside_a,
|
||||||
),
|
),
|
||||||
"axis on top" => nothing,
|
"axis on top" => nothing,
|
||||||
|
"name" => string(sp_id),
|
||||||
)
|
)
|
||||||
sp_width > 0*mm ? push!(axis_opt, "width" => string(sp_width)) : nothing
|
sp_width > 0*mm ? push!(axis_opt, "width" => string(sp_width)) : nothing
|
||||||
sp_height > 0*mm ? push!(axis_opt, "height" => string(sp_height)) : nothing
|
sp_height > 0*mm ? push!(axis_opt, "height" => string(sp_height)) : nothing
|
||||||
@ -283,16 +289,14 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
##< handle insets
|
##< 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
|
if sp in inset_subplots
|
||||||
push!(axis.options, PGFPlotsX.Options(
|
dx, dy = sp.bbox.x0
|
||||||
"at" => "($())", # TODO: insert correct ID here
|
push!(axis.options,
|
||||||
"anchor" => "outer south west", # TODO: check this
|
"at" => "($(_pgfplotsx_subplot_ids[Symbol(string(sp.parent[:subplot_index]))]).north west)",
|
||||||
))
|
"anchor" => "outer north west",
|
||||||
|
"xshift" => string(dx),
|
||||||
|
"yshift" => string(-dy)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
##>
|
##>
|
||||||
push!( the_plot, axis )
|
push!( the_plot, axis )
|
||||||
@ -441,6 +445,8 @@ function pgfx_series_coordinates!(st_val::Val{:filledcontour}, segment_opt, opt,
|
|||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
##
|
##
|
||||||
|
const _pgfplotsx_subplot_ids = KW()
|
||||||
|
|
||||||
const _pgfplotsx_linestyles = KW(
|
const _pgfplotsx_linestyles = KW(
|
||||||
:solid => "solid",
|
:solid => "solid",
|
||||||
:dash => "dashed",
|
:dash => "dashed",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user