a shift solution
This commit is contained in:
parent
154ecd9869
commit
f4dee045b6
@ -77,7 +77,6 @@ end
|
||||
function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
if !pgfx_plot.is_created
|
||||
the_plot = PGFPlotsX.TikzPicture(PGFPlotsX.Options())
|
||||
# rows, cols = size(plt.layout.grid)
|
||||
bgc = plt.attr[:background_color_outside] == :match ? plt.attr[:background_color] : plt.attr[:background_color_outside]
|
||||
if bgc isa Colors.Colorant
|
||||
cstr = plot_color(bgc)
|
||||
@ -85,7 +84,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
push!(
|
||||
the_plot.options,
|
||||
"/tikz/background rectangle/.style" => PGFPlotsX.Options(
|
||||
# "draw" => "black",
|
||||
"draw" => "black",
|
||||
"fill" => cstr,
|
||||
"draw opacity" => a,
|
||||
),
|
||||
@ -93,32 +92,15 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
)
|
||||
end
|
||||
|
||||
# the combination of groupplot and polaraxis is broken in pgfplots
|
||||
# if !any( sp -> ispolar(sp), plt.subplots )
|
||||
# pl_height, pl_width = plt.attr[:size]
|
||||
# push!( the_plot, PGFPlotsX.GroupPlot(
|
||||
# PGFPlotsX.Options(
|
||||
# "group style" => PGFPlotsX.Options(
|
||||
# "group size" => string(cols)*" by "*string(rows),
|
||||
# "horizontal sep" => string(maximum(sp -> sp.minpad[1], plt.subplots)),
|
||||
# "vertical sep" => string(maximum(sp -> sp.minpad[2], plt.subplots)),
|
||||
# ),
|
||||
# "height" => pl_height > 0 ? string(pl_height * px) : "{}",
|
||||
# "width" => pl_width > 0 ? string(pl_width * px) : "{}",
|
||||
# )
|
||||
# )
|
||||
# )
|
||||
# end
|
||||
inset_subplots = plt.inset_subplots
|
||||
parents = getproperty.(inset_subplots, :parent)
|
||||
total_height = bottom(bbox(plt.layout))
|
||||
for sp in plt.subplots
|
||||
sp_id = uuid4()
|
||||
_pgfplotsx_subplot_ids[Symbol("$(sp[:subplot_index])")] = sp_id
|
||||
bb = bbox(sp)
|
||||
sp_width = width(bb)
|
||||
sp_height = height(bb)
|
||||
dx, dy = bb.x0
|
||||
# TODO: does this hold at every scale?
|
||||
if sp[:legend] in (:outertopright, nothing)
|
||||
dx *= 1.2
|
||||
end
|
||||
cstr = plot_color(sp[:background_color_legend])
|
||||
a = alpha(cstr)
|
||||
fg_alpha = alpha(plot_color(sp[:foreground_color_legend]))
|
||||
@ -157,10 +139,11 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
"opacity" => bgc_inside_a,
|
||||
),
|
||||
"axis on top" => nothing,
|
||||
"name" => string(sp_id),
|
||||
"anchor" => "outer north west",
|
||||
"framed" => nothing,
|
||||
# These are for layouting
|
||||
"anchor" => "north west",
|
||||
"xshift" => string(dx),
|
||||
"yshift" => string(-dy)
|
||||
"yshift" => string(-dy),
|
||||
)
|
||||
sp_width > 0 * mm ? push!(axis_opt, "width" => string(sp_width)) :
|
||||
nothing
|
||||
@ -527,8 +510,6 @@ function pgfx_series_coordinates!(
|
||||
"""
|
||||
end
|
||||
##
|
||||
const _pgfplotsx_subplot_ids = KW()
|
||||
|
||||
const _pgfplotsx_linestyles = KW(
|
||||
:solid => "solid",
|
||||
:dash => "dashed",
|
||||
@ -1011,11 +992,11 @@ end
|
||||
# to fit ticks, tick labels, guides, colorbars, etc.
|
||||
function _update_min_padding!(sp::Subplot{PGFPlotsXBackend})
|
||||
# TODO: make padding more intelligent
|
||||
# TODO: how to include margins properly?
|
||||
# sp.minpad = (50mm + sp[:left_margin],
|
||||
# 0mm + sp[:top_margin],
|
||||
# 50mm + sp[:right_margin],
|
||||
# 0mm + sp[:bottom_margin])
|
||||
# TODO: currently padding does not apply
|
||||
sp.minpad = (50mm + sp[:left_margin],
|
||||
0mm + sp[:top_margin],
|
||||
50mm + sp[:right_margin],
|
||||
0mm + sp[:bottom_margin])
|
||||
end
|
||||
|
||||
function _create_backend_figure(plt::Plot{PGFPlotsXBackend})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user