Support plotting OffsetArrays for :sticks series type
This commit is contained in:
parent
2774b155b4
commit
94ca183a5b
@ -268,15 +268,15 @@ end
|
||||
end
|
||||
end
|
||||
newx, newy = zeros(3n), zeros(3n)
|
||||
newz = z!== nothing ? zeros(3n) : nothing
|
||||
for i = 1:n
|
||||
newz = z !== nothing ? zeros(3n) : nothing
|
||||
for (i, (xi, yi, zi)) = enumerate(zip(x, y, z !== nothing ? z : 1:n))
|
||||
rng = (3i - 2):(3i)
|
||||
newx[rng] = [x[i], x[i], NaN]
|
||||
newx[rng] = [xi, xi, NaN]
|
||||
if z !== nothing
|
||||
newy[rng] = [y[i], y[i], NaN]
|
||||
newz[rng] = [_cycle(fr, i), z[i], NaN]
|
||||
newy[rng] = [yi, yi, NaN]
|
||||
newz[rng] = [_cycle(fr, i), zi, NaN]
|
||||
else
|
||||
newy[rng] = [_cycle(fr, i), y[i], NaN]
|
||||
newy[rng] = [_cycle(fr, i), yi, NaN]
|
||||
end
|
||||
end
|
||||
x := newx
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
using Plots, Test
|
||||
using OffsetArrays
|
||||
|
||||
@testset "lens!" begin
|
||||
pl = plot(1:5)
|
||||
lens!(pl, [1,2], [1,2], inset = (1, bbox(0.0,0.0,0.2,0.2)), colorbar = false)
|
||||
@ -23,3 +25,9 @@ end # testset
|
||||
vsp = vspan([1,3], ylims=(-2,5), widen = false)
|
||||
@test Plots.ylims(vsp) == (-2,5)
|
||||
end # testset
|
||||
|
||||
@testset "offset axes" begin
|
||||
tri = OffsetVector(vcat(1:5, 4:-1:1), 11:19)
|
||||
sticks = plot(tri, seriestype = :sticks)
|
||||
@test length(sticks) == 1
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user