gr: improved calculation of bottom margin
This commit is contained in:
parent
20bd9d6160
commit
50ec31a7a3
@ -357,7 +357,7 @@ function gr_set_fill(c) #, a)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# this stores the conversion from a font pointsize to "percentage of window height" (which is what GR uses)
|
# this stores the conversion from a font pointsize to "percentage of window height" (which is what GR uses)
|
||||||
const _gr_point_mult = zeros(1)
|
const _gr_point_mult = 0.0018 * ones(1)
|
||||||
|
|
||||||
# set the font attributes... assumes _gr_point_mult has been populated already
|
# set the font attributes... assumes _gr_point_mult has been populated already
|
||||||
function gr_set_font(f::Font; halign = f.halign, valign = f.valign,
|
function gr_set_font(f::Font; halign = f.halign, valign = f.valign,
|
||||||
@ -388,7 +388,7 @@ end
|
|||||||
const viewport_plotarea = zeros(4)
|
const viewport_plotarea = zeros(4)
|
||||||
|
|
||||||
# the size of the current plot in pixels
|
# the size of the current plot in pixels
|
||||||
const gr_plot_size = zeros(2)
|
const gr_plot_size = [600.0, 400.0]
|
||||||
|
|
||||||
function gr_viewport_from_bbox(sp::Subplot{GRBackend}, bb::BoundingBox, w, h, viewport_canvas)
|
function gr_viewport_from_bbox(sp::Subplot{GRBackend}, bb::BoundingBox, w, h, viewport_canvas)
|
||||||
viewport = zeros(4)
|
viewport = zeros(4)
|
||||||
@ -546,8 +546,23 @@ function _update_min_padding!(sp::Subplot{GRBackend})
|
|||||||
toppad += 5mm
|
toppad += 5mm
|
||||||
end
|
end
|
||||||
if sp[:xaxis][:guide] != ""
|
if sp[:xaxis][:guide] != ""
|
||||||
|
xticks = axis_drawing_info(sp)[1]
|
||||||
|
if !(xticks in (nothing, false))
|
||||||
|
gr_set_font(sp[:xaxis][:tickfont],
|
||||||
|
halign = (:left, :hcenter, :right)[sign(sp[:xaxis][:rotation]) + 2],
|
||||||
|
valign = :top,
|
||||||
|
color = sp[:xaxis][:foreground_color_axis],
|
||||||
|
rotation = sp[:xaxis][:rotation])
|
||||||
|
h = 0
|
||||||
|
for (cv, dv) in zip(xticks...)
|
||||||
|
tbx, tby = gr_inqtext(0, 0, string(dv))
|
||||||
|
h = max(h, tby[2] - tby[1])
|
||||||
|
end
|
||||||
|
bottompad += 1mm + gr_plot_size[2] * h * px
|
||||||
|
else
|
||||||
bottompad += 4mm
|
bottompad += 4mm
|
||||||
end
|
end
|
||||||
|
end
|
||||||
if sp[:yaxis][:guide] != ""
|
if sp[:yaxis][:guide] != ""
|
||||||
leftpad += 4mm
|
leftpad += 4mm
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user