add tests, disable gridlines of twinx

This commit is contained in:
Simon Christ 2021-06-10 10:52:53 +02:00
parent 5afd15815c
commit 3044bf5482
2 changed files with 16 additions and 3 deletions

View File

@ -783,6 +783,9 @@ function twinx(sp::Subplot)
bottom_margin = sp[:bottom_margin], bottom_margin = sp[:bottom_margin],
) )
twinsp = sp.plt.subplots[end] twinsp = sp.plt.subplots[end]
twinsp[:xaxis][:grid] = false
twinsp[:yaxis][:grid] = false
twinsp[:xaxis][:showaxis] = false
twinsp[:yaxis][:mirror] = true twinsp[:yaxis][:mirror] = true
twinsp[:background_color_inside] = RGBA{Float64}(0,0,0,0) twinsp[:background_color_inside] = RGBA{Float64}(0,0,0,0)
link_axes!(sp[:xaxis], twinsp[:xaxis]) link_axes!(sp[:xaxis], twinsp[:xaxis])

View File

@ -53,3 +53,13 @@ end
ql = quiver([1, 2], [2, 1], [3, 4], quiver = ([1, -1], [0, 0], [1, -0.5]), arrow=true) ql = quiver([1, 2], [2, 1], [3, 4], quiver = ([1, -1], [0, 0], [1, -0.5]), arrow=true)
@test ql[1][:projection] == "3d" @test ql[1][:projection] == "3d"
end end
@testset "twinx" begin
pl = plot(1:10, margin = 2Plots.cm)
twpl = twinx(pl)
pl! = plot!(twinx(), -(1:10))
@test twpl[:right_margin] == 2Plots.cm
@test twpl[:left_margin] == 2Plots.cm
@test twpl[:top_margin] == 2Plots.cm
@test twpl[:bottom_margin] == 2Plots.cm
end