From 87031984d980a920afda633000dc2a97d4c361d8 Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Fri, 27 May 2016 00:14:22 -0400 Subject: [PATCH] widen gr limits; fixes #265 --- src/backends/gr.jl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 87c5f753..4536d2c4 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -266,17 +266,24 @@ end # zmin, zmax # end +function widen(lims) + lmin, lmax = lims + span = lmax - lmin + eps = max(1e-16, min(1e-2span, 1e-10)) + lmin-eps, lmax+eps +end + # using the axis extrema and limit overrides, return the min/max value for this axis -gr_x_axislims(sp::Subplot) = axis_limits(sp.attr[:xaxis]) -gr_y_axislims(sp::Subplot) = axis_limits(sp.attr[:yaxis]) -gr_z_axislims(sp::Subplot) = axis_limits(sp.attr[:zaxis]) +gr_x_axislims(sp::Subplot) = widen(axis_limits(sp.attr[:xaxis])) +gr_y_axislims(sp::Subplot) = widen(axis_limits(sp.attr[:yaxis])) +gr_z_axislims(sp::Subplot) = widen(axis_limits(sp.attr[:zaxis])) gr_xy_axislims(sp::Subplot) = gr_x_axislims(sp)..., gr_y_axislims(sp)... function gr_lims(axis::Axis, adjust::Bool, expand = nothing) if expand != nothing expand_extrema!(axis, expand) end - lims = axis_limits(axis) + lims = widen(axis_limits(axis)) if adjust GR.adjustrange(lims...) else