Compare commits
4 Commits
master
...
bbs/date-i
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
021691d220 | ||
|
|
eae40922fe | ||
|
|
c041112b9c | ||
|
|
099817e083 |
@ -122,8 +122,8 @@ end
|
|||||||
@deps hline straightline
|
@deps hline straightline
|
||||||
|
|
||||||
@recipe function f(::Type{Val{:vline}}, x, y, z)
|
@recipe function f(::Type{Val{:vline}}, x, y, z)
|
||||||
n = length(x)
|
n = length(y)
|
||||||
newx = vec(Float64[xi for i = 1:3, xi in x])
|
newx = vec(Float64[yi for i = 1:3, yi in y])
|
||||||
x := newx
|
x := newx
|
||||||
y := repeat(Float64[1, 2, NaN], n)
|
y := repeat(Float64[1, 2, NaN], n)
|
||||||
seriestype := :straightline
|
seriestype := :straightline
|
||||||
@ -133,7 +133,7 @@ end
|
|||||||
|
|
||||||
@recipe function f(::Type{Val{:hspan}}, x, y, z)
|
@recipe function f(::Type{Val{:hspan}}, x, y, z)
|
||||||
n = div(length(y), 2)
|
n = div(length(y), 2)
|
||||||
newx = repeat([-Inf, Inf, Inf, -Inf, NaN], outer = n)
|
newx = repeat([1, 2, 2, 1, NaN], outer = n)
|
||||||
newy = vcat([[y[2i - 1], y[2i - 1], y[2i], y[2i], NaN] for i = 1:n]...)
|
newy = vcat([[y[2i - 1], y[2i - 1], y[2i], y[2i], NaN] for i = 1:n]...)
|
||||||
linewidth --> 0
|
linewidth --> 0
|
||||||
x := newx
|
x := newx
|
||||||
@ -144,8 +144,8 @@ end
|
|||||||
@deps hspan shape
|
@deps hspan shape
|
||||||
|
|
||||||
@recipe function f(::Type{Val{:vspan}}, x, y, z)
|
@recipe function f(::Type{Val{:vspan}}, x, y, z)
|
||||||
n = div(length(x), 2)
|
n = div(length(y), 2)
|
||||||
newx = vcat([[x[2i - 1], x[2i - 1], x[2i], x[2i], NaN] for i = 1:n]...)
|
newx = vcat([[y[2i - 1], y[2i - 1], y[2i], y[2i], NaN] for i = 1:n]...)
|
||||||
newy = repeat([-Inf, Inf, Inf, -Inf, NaN], outer = n)
|
newy = repeat([-Inf, Inf, Inf, -Inf, NaN], outer = n)
|
||||||
linewidth --> 0
|
linewidth --> 0
|
||||||
x := newx
|
x := newx
|
||||||
|
|||||||
16
test/integration_dates.jl
Normal file
16
test/integration_dates.jl
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using Plots, Test, Dates
|
||||||
|
|
||||||
|
@testset "Limits" begin
|
||||||
|
y=[1.0*i*i for i in 1:10]
|
||||||
|
x=[Date(2019,11,i) for i in 1:10]
|
||||||
|
|
||||||
|
rx=[x[3],x[5]]
|
||||||
|
|
||||||
|
p = plot(x,y, widen = false)
|
||||||
|
vspan!(p, rx, label="", alpha=0.2)
|
||||||
|
|
||||||
|
ref_ylims = (y[1], y[end])
|
||||||
|
ref_xlims = (x[1].instant.periods.value, x[end].instant.periods.value)
|
||||||
|
@test Plots.ylims(p) == ref_ylims
|
||||||
|
@test Plots.xlims(p) == ref_xlims
|
||||||
|
end # testset
|
||||||
@ -16,6 +16,7 @@ include("test_axis_letter.jl")
|
|||||||
include("test_recipes.jl")
|
include("test_recipes.jl")
|
||||||
include("test_hdf5plots.jl")
|
include("test_hdf5plots.jl")
|
||||||
include("test_pgfplotsx.jl")
|
include("test_pgfplotsx.jl")
|
||||||
|
include("integration_dates.jl")
|
||||||
|
|
||||||
reference_dir(args...) = joinpath(homedir(), ".julia", "dev", "PlotReferenceImages", args...)
|
reference_dir(args...) = joinpath(homedir(), ".julia", "dev", "PlotReferenceImages", args...)
|
||||||
|
|
||||||
|
|||||||
@ -4,3 +4,21 @@ using Plots, Test
|
|||||||
lens!(pl, [1,2], [1,2], inset = (1, bbox(0.0,0.0,0.2,0.2)))
|
lens!(pl, [1,2], [1,2], inset = (1, bbox(0.0,0.0,0.2,0.2)))
|
||||||
@test length(pl.series_list) == 4
|
@test length(pl.series_list) == 4
|
||||||
end # testset
|
end # testset
|
||||||
|
|
||||||
|
@testset "vline, vspan" begin
|
||||||
|
vl = vline([1], widen = false)
|
||||||
|
@test Plots.xlims(vl) == (1,2)
|
||||||
|
@test Plots.ylims(vl) == (1,2)
|
||||||
|
vl = vline([1], xlims=(0,2), widen = false)
|
||||||
|
@test Plots.xlims(vl) == (0,2)
|
||||||
|
vl = vline([1], ylims=(-3,5), widen = false)
|
||||||
|
@test Plots.ylims(vl) == (-3,5)
|
||||||
|
|
||||||
|
vsp = vspan([1,3], widen = false)
|
||||||
|
@test Plots.xlims(vsp) == (1,3)
|
||||||
|
@test Plots.ylims(vsp) == (0,1) # TODO: might be problematic on log-scales
|
||||||
|
vsp = vspan([1,3], xlims=(-2,5), widen = false)
|
||||||
|
@test Plots.xlims(vsp) == (-2,5)
|
||||||
|
vsp = vspan([1,3], ylims=(-2,5), widen = false)
|
||||||
|
@test Plots.ylims(vsp) == (-2,5)
|
||||||
|
end # testset
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user