gr: improve Y label alignment
This commit is contained in:
parent
6546879d3a
commit
4849772435
@ -944,12 +944,13 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
if yaxis[:guide] != ""
|
if yaxis[:guide] != ""
|
||||||
gr_set_font(guidefont(yaxis))
|
gr_set_font(guidefont(yaxis))
|
||||||
GR.setcharup(-1, 0)
|
GR.setcharup(-1, 0)
|
||||||
|
x_margin = 0.075 * (viewport_subplot[2] - viewport_subplot[1])
|
||||||
if yaxis[:guide_position] == :right || (yaxis[:guide_position] == :auto && yaxis[:mirror] == true)
|
if yaxis[:guide_position] == :right || (yaxis[:guide_position] == :auto && yaxis[:mirror] == true)
|
||||||
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_BOTTOM)
|
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_BOTTOM)
|
||||||
gr_text(viewport_subplot[2], gr_view_ycenter(), yaxis[:guide])
|
gr_text(viewport_plotarea[2] + x_margin, gr_view_ycenter(), yaxis[:guide])
|
||||||
else
|
else
|
||||||
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_TOP)
|
GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_TOP)
|
||||||
gr_text(viewport_subplot[1], gr_view_ycenter(), yaxis[:guide])
|
gr_text(viewport_plotarea[1] - x_margin, gr_view_ycenter(), yaxis[:guide])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user