Fix line_z for PyPlot backend

`LineCollection` expects an array with pairs of coordinates,
corresponding to the starting and ending points of each segment.
This commit is contained in:
Darwin Darakananda 2017-10-04 14:26:35 -07:00
parent 073724a84c
commit f5ee5ea814

View File

@ -508,11 +508,12 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
handle = if is3d(st) handle = if is3d(st)
for rng in iter_segments(x, y, z) for rng in iter_segments(x, y, z)
length(rng) < 2 && continue length(rng) < 2 && continue
push!(segments, [(_cycle(x,i),_cycle(y,i),_cycle(z,i)) for i in rng]) for i in rng[1:end-1]
push!(segments, [(_cycle(x,i),_cycle(y,i),_cycle(z,i)),
(_cycle(x,i+1),_cycle(y,i+1),_cycle(z,i+1))])
end
end end
# for i=1:n
# segments[i] = [(_cycle(x,i), _cycle(y,i), _cycle(z,i)), (_cycle(x,i+1), _cycle(y,i+1), _cycle(z,i+1))]
# end
lc = pyart3d["Line3DCollection"](segments; kw...) lc = pyart3d["Line3DCollection"](segments; kw...)
lc[:set_array](lz) lc[:set_array](lz)
ax[:add_collection3d](lc, zs=z) #, zdir='y') ax[:add_collection3d](lc, zs=z) #, zdir='y')
@ -520,11 +521,11 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
else else
for rng in iter_segments(x, y) for rng in iter_segments(x, y)
length(rng) < 2 && continue length(rng) < 2 && continue
push!(segments, [(_cycle(x,i),_cycle(y,i)) for i in rng]) for i in rng[1:end-1]
push!(segments, [(_cycle(x,i),_cycle(y,i)), (_cycle(x,i+1),_cycle(y,i+1))])
end
end end
# for i=1:n
# segments[i] = [(_cycle(x,i), _cycle(y,i)), (_cycle(x,i+1), _cycle(y,i+1))]
# end
lc = pycollections["LineCollection"](segments; kw...) lc = pycollections["LineCollection"](segments; kw...)
lc[:set_array](lz) lc[:set_array](lz)
ax[:add_collection](lc) ax[:add_collection](lc)