pyplot line segments fixes; curves remove line_z logic
This commit is contained in:
parent
71b48427c5
commit
a456ac4c90
@ -445,26 +445,29 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
:linewidth => py_dpi_scale(plt, series[:linewidth]),
|
:linewidth => py_dpi_scale(plt, series[:linewidth]),
|
||||||
:linestyle => py_linestyle(st, series[:linestyle])
|
:linestyle => py_linestyle(st, series[:linestyle])
|
||||||
)
|
)
|
||||||
|
lz = collect(series[:line_z])
|
||||||
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
|
||||||
push!(segments, [(cycle(x,i),cycle(y,i),cycle(z,i)) for i in rng])
|
push!(segments, [(cycle(x,i),cycle(y,i),cycle(z,i)) for i in rng])
|
||||||
end
|
end
|
||||||
# for i=1:n
|
# 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))]
|
# segments[i] = [(cycle(x,i), cycle(y,i), cycle(z,i)), (cycle(x,i+1), cycle(y,i+1), cycle(z,i+1))]
|
||||||
# end
|
# end
|
||||||
lc = pyart3d.Line3DCollection(segments; kw...)
|
lc = pyart3d.Line3DCollection(segments; kw...)
|
||||||
lc[:set_array](series[:line_z])
|
lc[:set_array](lz)
|
||||||
ax[:add_collection3d](lc, zs=z) #, zdir='y')
|
ax[:add_collection3d](lc, zs=z) #, zdir='y')
|
||||||
lc
|
lc
|
||||||
else
|
else
|
||||||
for rng in iter_segments(x, y)
|
for rng in iter_segments(x, y)
|
||||||
|
length(rng) < 2 && continue
|
||||||
push!(segments, [(cycle(x,i),cycle(y,i)) for i in rng])
|
push!(segments, [(cycle(x,i),cycle(y,i)) for i in rng])
|
||||||
end
|
end
|
||||||
# for i=1:n
|
# for i=1:n
|
||||||
# segments[i] = [(cycle(x,i), cycle(y,i)), (cycle(x,i+1), cycle(y,i+1))]
|
# segments[i] = [(cycle(x,i), cycle(y,i)), (cycle(x,i+1), cycle(y,i+1))]
|
||||||
# end
|
# end
|
||||||
lc = pycollections.LineCollection(segments; kw...)
|
lc = pycollections.LineCollection(segments; kw...)
|
||||||
lc[:set_array](series[:line_z])
|
lc[:set_array](lz)
|
||||||
ax[:add_collection](lc)
|
ax[:add_collection](lc)
|
||||||
lc
|
lc
|
||||||
end
|
end
|
||||||
|
|||||||
@ -346,8 +346,8 @@ end
|
|||||||
fr = d[:fillrange]
|
fr = d[:fillrange]
|
||||||
newfr = fr != nothing ? zeros(0) : nothing
|
newfr = fr != nothing ? zeros(0) : nothing
|
||||||
newz = z != nothing ? zeros(0) : nothing
|
newz = z != nothing ? zeros(0) : nothing
|
||||||
lz = d[:line_z]
|
# lz = d[:line_z]
|
||||||
newlz = lz != nothing ? zeros(0) : nothing
|
# newlz = lz != nothing ? zeros(0) : nothing
|
||||||
|
|
||||||
# for each line segment (point series with no NaNs), convert it into a bezier curve
|
# for each line segment (point series with no NaNs), convert it into a bezier curve
|
||||||
# where the points are the control points of the curve
|
# where the points are the control points of the curve
|
||||||
@ -362,11 +362,11 @@ end
|
|||||||
if fr != nothing
|
if fr != nothing
|
||||||
nanappend!(newfr, map(t -> bezier_value(cycle(fr,rng), t), ts))
|
nanappend!(newfr, map(t -> bezier_value(cycle(fr,rng), t), ts))
|
||||||
end
|
end
|
||||||
if lz != nothing
|
# if lz != nothing
|
||||||
lzrng = cycle(lz, rng) # the line_z's for this segment
|
# lzrng = cycle(lz, rng) # the line_z's for this segment
|
||||||
push!(newlz, 0.0)
|
# push!(newlz, 0.0)
|
||||||
append!(newlz, map(t -> lzrng[1+floor(Int, t * (length(rng)-1))], ts))
|
# append!(newlz, map(t -> lzrng[1+floor(Int, t * (length(rng)-1))], ts))
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
x := newx
|
x := newx
|
||||||
@ -380,10 +380,10 @@ end
|
|||||||
if fr != nothing
|
if fr != nothing
|
||||||
fillrange := newfr
|
fillrange := newfr
|
||||||
end
|
end
|
||||||
if lz != nothing
|
# if lz != nothing
|
||||||
line_z := newlz
|
# # line_z := newlz
|
||||||
linecolor := (isa(d[:linecolor], ColorGradient) ? d[:linecolor] : cgrad())
|
# linecolor := (isa(d[:linecolor], ColorGradient) ? d[:linecolor] : cgrad())
|
||||||
end
|
# end
|
||||||
# Plots.DD(d)
|
# Plots.DD(d)
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user