padding of grouplots

This commit is contained in:
Simon Christ 2019-11-21 13:03:37 +01:00
parent 1f14a4d4c6
commit 4c6b96e38a
2 changed files with 10 additions and 2 deletions

View File

@ -24,7 +24,9 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
push!( the_plot, PGFPlotsX.GroupPlot(
PGFPlotsX.Options(
"group style" => PGFPlotsX.Options(
"group size" => string(cols)*" by "*string(rows)
"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)),
)
)
)
@ -550,6 +552,13 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
end
# --------------------------------------------------------------------------------------
# display calls this and then _display, its called 3 times for plot(1:5)
# Set the (left, top, right, bottom) minimum padding around the plot area
# to fit ticks, tick labels, guides, colorbars, etc.
function _update_min_padding!(sp::Subplot{PGFPlotsXBackend})
# TODO: make padding more intelligent
sp.minpad = (20mm, 5mm, 2mm, 10mm)
end
function _create_backend_figure(plt::Plot{PGFPlotsXBackend})
plt.o = PGFPlotsXPlot()
end

View File

@ -59,7 +59,6 @@ end
end # testset
@testset "Layout" begin
plot(Plots.fakedata(100, 10), layout=4, palette=[:grays :blues :heat :lightrainbow], bg_inside=[:orange :pink :darkblue :black])
# TODO: no extra space for outer legends
end # testset
@testset "Polar plots" begin
Θ = range(0, stop=1.5π, length=100)