outer legends for GR
This commit is contained in:
parent
903cb404c3
commit
0e3a9f0b8f
@ -535,14 +535,26 @@ function gr_legend_pos(s::Symbol,w,h)
|
|||||||
xpos = viewport_plotarea[2] - 0.05 - w
|
xpos = viewport_plotarea[2] - 0.05 - w
|
||||||
end
|
end
|
||||||
elseif occursin("left", str)
|
elseif occursin("left", str)
|
||||||
xpos = viewport_plotarea[1] + 0.11
|
if occursin("outer", str)
|
||||||
|
xpos = viewport_plotarea[1] - 0.11 - w
|
||||||
|
else
|
||||||
|
xpos = viewport_plotarea[1] + 0.11
|
||||||
|
end
|
||||||
else
|
else
|
||||||
xpos = (viewport_plotarea[2]-viewport_plotarea[1])/2 - w/2 +.04
|
xpos = (viewport_plotarea[2]-viewport_plotarea[1])/2 - w/2 +.04
|
||||||
end
|
end
|
||||||
if occursin("top", str)
|
if occursin("top", str)
|
||||||
ypos = viewport_plotarea[4] - 0.06
|
if s == :outertop
|
||||||
|
ypos = viewport_plotarea[4] + h + 0.01
|
||||||
|
else
|
||||||
|
ypos = viewport_plotarea[4] - 0.06
|
||||||
|
end
|
||||||
elseif occursin("bottom", str)
|
elseif occursin("bottom", str)
|
||||||
ypos = viewport_plotarea[3] + h + 0.06
|
if s == :outerbottom
|
||||||
|
ypos = viewport_plotarea[3] - 0.11
|
||||||
|
else
|
||||||
|
ypos = viewport_plotarea[3] + h + 0.06
|
||||||
|
end
|
||||||
else
|
else
|
||||||
ypos = (viewport_plotarea[4]-viewport_plotarea[3])/2 + h/2
|
ypos = (viewport_plotarea[4]-viewport_plotarea[3])/2 + h/2
|
||||||
end
|
end
|
||||||
@ -790,8 +802,19 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
GR.restorestate()
|
GR.restorestate()
|
||||||
end
|
end
|
||||||
|
|
||||||
if occursin("outer", string(sp[:legend]))
|
dy = _gr_point_mult[1] * sp[:legendfontsize] * 1.75
|
||||||
viewport_plotarea[2] -= legendw + 0.1
|
legendh = dy * legendn
|
||||||
|
leg_str = string(sp[:legend])
|
||||||
|
if occursin("outer", leg_str)
|
||||||
|
if occursin("right", leg_str)
|
||||||
|
viewport_plotarea[2] -= legendw + 0.1
|
||||||
|
elseif occursin("left", leg_str)
|
||||||
|
viewport_plotarea[1] += legendw + 0.13
|
||||||
|
elseif occursin("top", leg_str)
|
||||||
|
viewport_plotarea[4] -= legendh + 0.06
|
||||||
|
elseif occursin("bottom", leg_str)
|
||||||
|
viewport_plotarea[3] += legendh + 0.09
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# fill in the plot area background
|
# fill in the plot area background
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user