diff --git a/src/Plots.jl b/src/Plots.jl index e8113cac..4eb76c34 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -182,7 +182,10 @@ import RecipesPipeline: SliceIt, pop_kw!, scale_func, inverse_scale_func, - unzip + unzip, + dateformatter, + datetimeformatter, + timeformatter include("types.jl") include("utils.jl") diff --git a/src/axes.jl b/src/axes.jl index 4069b4e6..76c465d1 100644 --- a/src/axes.jl +++ b/src/axes.jl @@ -139,7 +139,7 @@ function optimal_ticks_and_labels(sp::Subplot, axis::Axis, ticks = nothing) # rather than on the input format # TODO: maybe: non-trivial scale (:ln, :log2, :log10) for date/datetime if ticks === nothing && scale == :identity - if axis[:formatter] == dateformatter + if axis[:formatter] == RecipesPipeline.dateformatter # optimize_datetime_ticks returns ticks and labels(!) based on # integers/floats corresponding to the DateTime type. Thus, the axes # limits, which resulted from converting the Date type to integers, @@ -150,7 +150,7 @@ function optimal_ticks_and_labels(sp::Subplot, axis::Axis, ticks = nothing) k_min = 2, k_max = 4) # Now the ticks are converted back to floats corresponding to Dates. return ticks / 864e5, labels - elseif axis[:formatter] == datetimeformatter + elseif axis[:formatter] == RecipesPipeline.datetimeformatter return optimize_datetime_ticks(amin, amax; k_min = 2, k_max = 4) end end diff --git a/src/recipes.jl b/src/recipes.jl index 5b8d6694..6fcea5ad 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -1415,26 +1415,6 @@ abline!(plt::Plot, a, b; kw...) = abline!(args...; kw...) = abline!(current(), args...; kw...) - -# ------------------------------------------------- -# Dates & Times - -dateformatter(dt) = string(Date(Dates.UTD(dt))) -datetimeformatter(dt) = string(DateTime(Dates.UTM(dt))) -timeformatter(t) = string(Dates.Time(Dates.Nanosecond(t))) - -@recipe f(::Type{Date}, dt::Date) = (dt -> Dates.value(dt), dateformatter) -@recipe f(::Type{DateTime}, dt::DateTime) = - (dt -> Dates.value(dt), datetimeformatter) -@recipe f(::Type{Dates.Time}, t::Dates.Time) = (t -> Dates.value(t), timeformatter) -@recipe f(::Type{P}, t::P) where {P<:Dates.Period} = - (t -> Dates.value(t), t -> string(P(t))) - -# ------------------------------------------------- -# Characters - -@recipe f(::Type{<:AbstractChar}, ::AbstractChar) = (string, string) - # ------------------------------------------------- # Complex Numbers