From 0d956739d57d87b7557649aaf4948fcf24fb60d4 Mon Sep 17 00:00:00 2001 From: Zhanibek Date: Thu, 4 Jan 2024 19:38:47 +0900 Subject: [PATCH] fix python twin ax --- src/backends/pythonplot.jl | 4 ++-- test/test_axes.jl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backends/pythonplot.jl b/src/backends/pythonplot.jl index f1fc59df1..421c11fc9 100644 --- a/src/backends/pythonplot.jl +++ b/src/backends/pythonplot.jl @@ -1229,10 +1229,10 @@ function _before_layout_calcs(plt::Plot{PythonPlotBackend}) # link axes x_ax_link, y_ax_link = xaxis.sps[1].o, yaxis.sps[1].o if Bool(ax != x_ax_link) # twinx - ax.get_shared_x_axes().join(ax, x_ax_link) + ax.sharey(y_ax_link) end if Bool(ax != y_ax_link) # twiny - ax.get_shared_y_axes().join(ax, y_ax_link) + ax.sharex(x_ax_link) end end # for sp in pl.subplots _py_drawfig(fig) diff --git a/test/test_axes.jl b/test/test_axes.jl index d06eabc5e..62092ac5b 100644 --- a/test/test_axes.jl +++ b/test/test_axes.jl @@ -141,7 +141,7 @@ end @testset "Twinx" begin pl = plot(1:10, margin = 2Plots.cm) twpl = twinx(pl) - pl! = plot!(twinx(), -(1:10)) + pl! = plot!(twpl, -(1:10)) @test twpl[:right_margin] == 2Plots.cm @test twpl[:left_margin] == 2Plots.cm @test twpl[:top_margin] == 2Plots.cm