fix gr legend position

This commit is contained in:
Simon Christ 2021-06-01 15:58:56 +02:00
parent f79c1623bd
commit cb5b0089f5
2 changed files with 3 additions and 5 deletions

View File

@ -1218,8 +1218,8 @@ function gr_update_viewport_legend!(viewport_plotarea, sp, leg)
xmirror = xaxis[:guide_position] == :top || (xaxis[:guide_position] == :auto && xaxis[:mirror] == true)
ymirror = yaxis[:guide_position] == :right || (yaxis[:guide_position] == :auto && yaxis[:mirror] == true)
if s isa Tuple{<:Real,Symbol}
if s[2] === :outer
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 + leg.textw + leg.rightw + leg.xoffset + !ymirror * gr_axis_width(sp, sp[:yaxis])
@ -1233,7 +1233,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

View File

@ -60,8 +60,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