From f9d9cba5aeb1ff13787bc84df97eb4e464f38f03 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Tue, 16 Nov 2021 13:19:34 -0500 Subject: [PATCH 1/3] user margin should override --- src/backends/gr.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index be46ff295..5943f0dfd 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -780,10 +780,10 @@ function _update_min_padding!(sp::Subplot{GRBackend}) end end # Add margin given by the user - leftpad = 2mm + sp[:left_margin] - toppad = 2mm + sp[:top_margin] - rightpad = 2mm + sp[:right_margin] - bottompad = 2mm + sp[:bottom_margin] + leftpad = sp[:left_margin] == :match ? 2mm : sp[:left_margin] + toppad = sp[:top_margin] == :match ? 2mm : sp[:top_margin] + rightpad = sp[:right_margin] == :match ? 2mm : sp[:right_margin] + bottompad = sp[:bottom_margin] == :match ? 2mm : sp[:bottom_margin] # Add margin for title if sp[:title] != "" gr_set_font(titlefont(sp), sp) From 1ad74fe129bc22dafa4f0e1d7a5ba6831ebffaa7 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Sun, 21 Nov 2021 19:55:09 -0500 Subject: [PATCH 2/3] Refinement to plotly, gr --- src/backends/gr.jl | 8 ++++---- src/backends/plotly.jl | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 5943f0dfd..fe52a8955 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -780,10 +780,10 @@ function _update_min_padding!(sp::Subplot{GRBackend}) end end # Add margin given by the user - leftpad = sp[:left_margin] == :match ? 2mm : sp[:left_margin] - toppad = sp[:top_margin] == :match ? 2mm : sp[:top_margin] - rightpad = sp[:right_margin] == :match ? 2mm : sp[:right_margin] - bottompad = sp[:bottom_margin] == :match ? 2mm : sp[:bottom_margin] + leftpad = sp[:left_margin] + toppad = sp[:top_margin] + rightpad = sp[:right_margin] + bottompad = sp[:bottom_margin] # Add margin for title if sp[:title] != "" gr_set_font(titlefont(sp), sp) diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index ad4ff3170..191dfb8ac 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -211,7 +211,7 @@ function plotly_layout(plt::Plot) w, h = plt[:size] plotattributes_out[:width], plotattributes_out[:height] = w, h plotattributes_out[:paper_bgcolor] = rgba_string(plt[:background_color_outside]) - plotattributes_out[:margin] = KW(:l => 0, :b => 20, :r => 0, :t => 20) + plotattributes_out[:margin] = KW(:l => 0, :b => 0, :r => 0, :t => 0) plotattributes_out[:annotations] = KW[] From 246b549436b373e9af444e05af2f7f8e19794a8b Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Thu, 25 Nov 2021 10:56:36 +0100 Subject: [PATCH 3/3] fix margin pgfplotsx --- src/backends/pgfplotsx.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index d6a6b5e39..5b853e289 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -105,6 +105,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend}) "show background rectangle" => nothing, ) end + push!(the_plot.options, "tight background" => nothing) for sp in plt.subplots bb2 = bbox(sp)