From 5afd15815c0ca0a79dda91cc7e48283b6fb1d4e8 Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Thu, 10 Jun 2021 10:34:07 +0200 Subject: [PATCH] improve twinx --- src/layouts.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/layouts.jl b/src/layouts.jl index ff4d0041..00c0f3f0 100644 --- a/src/layouts.jl +++ b/src/layouts.jl @@ -775,8 +775,13 @@ end "Adds a new, empty subplot overlayed on top of `sp`, with a mirrored y-axis and linked x-axis." function twinx(sp::Subplot) - sp[:right_margin] = max(sp[:right_margin], 30px) - plot!(sp.plt, inset = (sp[:subplot_index], bbox(0,0,1,1))) + plot!(sp.plt, + inset = (sp[:subplot_index], bbox(0,0,1,1)), + right_margin = sp[:right_margin], + left_margin = sp[:left_margin], + top_margin = sp[:top_margin], + bottom_margin = sp[:bottom_margin], + ) twinsp = sp.plt.subplots[end] twinsp[:yaxis][:mirror] = true twinsp[:background_color_inside] = RGBA{Float64}(0,0,0,0)