widen gr limits; fixes #265
This commit is contained in:
parent
83687f96a5
commit
87031984d9
@ -266,17 +266,24 @@ end
|
|||||||
# zmin, zmax
|
# zmin, zmax
|
||||||
# end
|
# 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
|
# 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_x_axislims(sp::Subplot) = widen(axis_limits(sp.attr[:xaxis]))
|
||||||
gr_y_axislims(sp::Subplot) = axis_limits(sp.attr[:yaxis])
|
gr_y_axislims(sp::Subplot) = widen(axis_limits(sp.attr[:yaxis]))
|
||||||
gr_z_axislims(sp::Subplot) = axis_limits(sp.attr[:zaxis])
|
gr_z_axislims(sp::Subplot) = widen(axis_limits(sp.attr[:zaxis]))
|
||||||
gr_xy_axislims(sp::Subplot) = gr_x_axislims(sp)..., gr_y_axislims(sp)...
|
gr_xy_axislims(sp::Subplot) = gr_x_axislims(sp)..., gr_y_axislims(sp)...
|
||||||
|
|
||||||
function gr_lims(axis::Axis, adjust::Bool, expand = nothing)
|
function gr_lims(axis::Axis, adjust::Bool, expand = nothing)
|
||||||
if expand != nothing
|
if expand != nothing
|
||||||
expand_extrema!(axis, expand)
|
expand_extrema!(axis, expand)
|
||||||
end
|
end
|
||||||
lims = axis_limits(axis)
|
lims = widen(axis_limits(axis))
|
||||||
if adjust
|
if adjust
|
||||||
GR.adjustrange(lims...)
|
GR.adjustrange(lims...)
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user