From b046ed9b90ce35a09591ae772bc58975280053df Mon Sep 17 00:00:00 2001 From: Thatcher Chamberlin Date: Tue, 1 Dec 2020 18:36:43 -0500 Subject: [PATCH] Added a Date & DateTime method for widen - enables xlims with Date or DateTime types --- src/axes.jl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/axes.jl b/src/axes.jl index 0ef3a3a7..1ad85a6d 100644 --- a/src/axes.jl +++ b/src/axes.jl @@ -426,6 +426,11 @@ end # ------------------------------------------------------------------------- +# handle widen in the case that xlims are of type Date or DateTime +function widen(dmin::Union{Date,DateTime}, dmax::Union{Date,DateTime}, scale = :identity) + widen(Dates.value(dmin), Dates.value(dmax), scale) +end + # push the limits out slightly function widen(lmin, lmax, scale = :identity) f, invf = RecipesPipeline.scale_func(scale), RecipesPipeline.inverse_scale_func(scale) @@ -674,7 +679,7 @@ function axis_drawing_info(sp, letter) reverse_if((tick, tick_stop), isy), ) end - if ax[:minorgrid] + if ax[:minorgrid] push!( minorgrid_segments, reverse_if((tick, oamin), isy), @@ -728,7 +733,7 @@ function axis_drawing_info_3d(sp, letter) minorgrid_segments = Segments(3) border_segments = Segments(3) - + if sp[:framestyle] != :none# && letter === :x na0, na1 = if sp[:framestyle] in (:origin, :zerolines) 0, 0 @@ -847,4 +852,4 @@ end reverse_if(x, cond) = cond ? reverse(x) : x axis_tuple(x, y, letter) = reverse_if((x, y), letter === :y) -axes_shift(t, i) = i % 3 == 0 ? t : i % 3 == 1 ? (t[3], t[1], t[2]) : (t[2], t[3], t[1]) \ No newline at end of file +axes_shift(t, i) = i % 3 == 0 ? t : i % 3 == 1 ? (t[3], t[1], t[2]) : (t[2], t[3], t[1])