Respect :widen when passing :lims
Previously, the limits were not widened when passing a tuple or :round to lims (ignoring the widen argument). Fixes #3339
This commit is contained in:
parent
cc290818d7
commit
43e9a3426b
@ -141,6 +141,7 @@ const _arg_desc = KW(
|
||||
NTuple{2,Number} or Symbol. Force axis limits. Only finite values are used (you can set only the right limit with `xlims = (-Inf, 2)` for example).
|
||||
`:round` widens the limit to the nearest round number ie. [0.1,3.6]=>[0.0,4.0]
|
||||
`:symmetric` sets the limits to be symmetric around zero.
|
||||
Additionally pass `widen=false` to use the specified limits exactly.
|
||||
""",
|
||||
:ticks => "Vector of numbers (set the tick values), Tuple of (tickvalues, ticklabels), or `:auto`",
|
||||
:scale => "Symbol. Scale of the axis: `:none`, `:ln`, `:log2`, `:log10`",
|
||||
|
||||
@ -504,17 +504,14 @@ end
|
||||
const _widen_seriestypes = (:line, :path, :steppre, :stepmid, :steppost, :sticks, :scatter, :barbins, :barhist, :histogram, :scatterbins, :scatterhist, :stepbins, :stephist, :bins2d, :histogram2d, :bar, :shape, :path3d, :scatter3d)
|
||||
|
||||
function default_should_widen(axis::Axis)
|
||||
should_widen = false
|
||||
if !(is_2tuple(axis[:lims]) || axis[:lims] == :round)
|
||||
for sp in axis.sps
|
||||
for series in series_list(sp)
|
||||
if series.plotattributes[:seriestype] in _widen_seriestypes
|
||||
should_widen = true
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
should_widen
|
||||
false
|
||||
end
|
||||
|
||||
function round_limits(amin,amax)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user