From c496b9c615689edd816d632f5b84d3ef4cea9239 Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Tue, 1 Jun 2021 15:58:56 +0200 Subject: [PATCH] fix gr legend position --- src/backends/gr.jl | 7 +++---- test/test_defaults.jl | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index c117b491..67c0b5cd 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -1300,9 +1300,9 @@ function gr_update_viewport_legend!(viewport_plotarea, sp, leg) yaxis[:guide_position] == :right || (yaxis[:guide_position] == :auto && yaxis[:mirror] == true) - if s isa Tuple{<:Real,Symbol} - if s[2] === :outer - (x, y) = gr_legend_pos(sp, leg, viewport_plotarea) # Dry run, to figure out + if sp[:legend_position] isa Tuple{<:Real,Symbol} + if sp[:legend_position][2] === :outer + (x,y) = gr_legend_pos(sp, leg, viewport_plotarea) # Dry run, to figure out if x < viewport_plotarea[1] viewport_plotarea[1] += leg.leftw + @@ -1321,7 +1321,6 @@ function gr_update_viewport_legend!(viewport_plotarea, sp, leg) end end end - leg_str = string(s) if occursin("outer", leg_str) if occursin("right", leg_str) viewport_plotarea[2] -= leg.leftw + leg.textw + leg.rightw + leg.xoffset diff --git a/test/test_defaults.jl b/test/test_defaults.jl index 8ca669d7..46025c44 100644 --- a/test/test_defaults.jl +++ b/test/test_defaults.jl @@ -62,8 +62,7 @@ end # testset # FIXME: this doesn't get set @test_broken p[1][:legend_title] == "The legend" @test p[1][:legend_title_font_family] == "helvetica" - # FIXME: this doesn't get set - @test_broken p[1][:legend_title_font_pointsize] == 3 + @test p[1][:legend_title_font_pointsize] == 3 @test p[1][:legend_title_font_halign] == :right @test p[1][:legend_title_font_valign] == :bottom @test p[1][:legend_title_font_rotation] == -5.2