fix margin in case there is no label (gr)

This commit is contained in:
Pietro Vertechi 2017-08-23 14:10:35 +01:00
parent e16125cb50
commit b3b533db94

View File

@ -543,14 +543,16 @@ end
function _update_min_padding!(sp::Subplot{GRBackend}) function _update_min_padding!(sp::Subplot{GRBackend})
# Add margin given by the user
leftpad = 10mm + sp[:left_margin] leftpad = 10mm + sp[:left_margin]
toppad = 2mm + sp[:top_margin] toppad = 2mm + sp[:top_margin]
rightpad = 2mm + sp[:right_margin] rightpad = 4mm + sp[:right_margin]
bottompad = 6mm + sp[:bottom_margin] bottompad = 2mm + sp[:bottom_margin]
# Add margin for title
if sp[:title] != "" if sp[:title] != ""
toppad += 5mm toppad += 5mm
end end
if sp[:xaxis][:guide] != "" # Add margin for x ticks
xticks = axis_drawing_info(sp)[1] xticks = axis_drawing_info(sp)[1]
if !(xticks in (nothing, false)) if !(xticks in (nothing, false))
gr_set_font(sp[:xaxis][:tickfont], gr_set_font(sp[:xaxis][:tickfont],
@ -565,10 +567,12 @@ function _update_min_padding!(sp::Subplot{GRBackend})
h = max(h, tby_max - tby_min) h = max(h, tby_max - tby_min)
end end
bottompad += 1mm + gr_plot_size[2] * h * px bottompad += 1mm + gr_plot_size[2] * h * px
else end
# Add margin for x label
if sp[:xaxis][:guide] != ""
bottompad += 4mm bottompad += 4mm
end end
end # Add margin for y label
if sp[:yaxis][:guide] != "" if sp[:yaxis][:guide] != ""
leftpad += 4mm leftpad += 4mm
end end