move some recipes to recipepipeline
This commit is contained in:
parent
2a88ab7726
commit
92d8bd7836
@ -182,7 +182,10 @@ import RecipesPipeline: SliceIt,
|
|||||||
pop_kw!,
|
pop_kw!,
|
||||||
scale_func,
|
scale_func,
|
||||||
inverse_scale_func,
|
inverse_scale_func,
|
||||||
unzip
|
unzip,
|
||||||
|
dateformatter,
|
||||||
|
datetimeformatter,
|
||||||
|
timeformatter
|
||||||
|
|
||||||
include("types.jl")
|
include("types.jl")
|
||||||
include("utils.jl")
|
include("utils.jl")
|
||||||
|
|||||||
@ -139,7 +139,7 @@ function optimal_ticks_and_labels(sp::Subplot, axis::Axis, ticks = nothing)
|
|||||||
# rather than on the input format
|
# rather than on the input format
|
||||||
# TODO: maybe: non-trivial scale (:ln, :log2, :log10) for date/datetime
|
# TODO: maybe: non-trivial scale (:ln, :log2, :log10) for date/datetime
|
||||||
if ticks === nothing && scale == :identity
|
if ticks === nothing && scale == :identity
|
||||||
if axis[:formatter] == dateformatter
|
if axis[:formatter] == RecipesPipeline.dateformatter
|
||||||
# optimize_datetime_ticks returns ticks and labels(!) based on
|
# optimize_datetime_ticks returns ticks and labels(!) based on
|
||||||
# integers/floats corresponding to the DateTime type. Thus, the axes
|
# integers/floats corresponding to the DateTime type. Thus, the axes
|
||||||
# limits, which resulted from converting the Date type to integers,
|
# 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)
|
k_min = 2, k_max = 4)
|
||||||
# Now the ticks are converted back to floats corresponding to Dates.
|
# Now the ticks are converted back to floats corresponding to Dates.
|
||||||
return ticks / 864e5, labels
|
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)
|
return optimize_datetime_ticks(amin, amax; k_min = 2, k_max = 4)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1415,26 +1415,6 @@ abline!(plt::Plot, a, b; kw...) =
|
|||||||
|
|
||||||
abline!(args...; kw...) = abline!(current(), args...; 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
|
# Complex Numbers
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user