From a456ac4c9016a508b447637195814a5a55fd1cc6 Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Fri, 8 Jul 2016 14:36:02 -0400 Subject: [PATCH] pyplot line segments fixes; curves remove line_z logic --- src/backends/pyplot.jl | 7 +++++-- src/recipes.jl | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 4a21eeb8..156c4431 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -445,26 +445,29 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series) :linewidth => py_dpi_scale(plt, series[:linewidth]), :linestyle => py_linestyle(st, series[:linestyle]) ) + lz = collect(series[:line_z]) handle = if is3d(st) 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]) 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[:set_array](series[:line_z]) + lc[:set_array](lz) ax[:add_collection3d](lc, zs=z) #, zdir='y') lc else for rng in iter_segments(x, y) + length(rng) < 2 && continue push!(segments, [(cycle(x,i),cycle(y,i)) for i in rng]) 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[:set_array](series[:line_z]) + lc[:set_array](lz) ax[:add_collection](lc) lc end diff --git a/src/recipes.jl b/src/recipes.jl index cc96fdc6..38f3b0c9 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -346,8 +346,8 @@ end fr = d[:fillrange] newfr = fr != nothing ? zeros(0) : nothing newz = z != nothing ? zeros(0) : nothing - lz = d[:line_z] - newlz = lz != nothing ? zeros(0) : nothing + # lz = d[:line_z] + # newlz = lz != nothing ? zeros(0) : nothing # 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 @@ -362,11 +362,11 @@ end if fr != nothing nanappend!(newfr, map(t -> bezier_value(cycle(fr,rng), t), ts)) end - if lz != nothing - lzrng = cycle(lz, rng) # the line_z's for this segment - push!(newlz, 0.0) - append!(newlz, map(t -> lzrng[1+floor(Int, t * (length(rng)-1))], ts)) - end + # if lz != nothing + # lzrng = cycle(lz, rng) # the line_z's for this segment + # push!(newlz, 0.0) + # append!(newlz, map(t -> lzrng[1+floor(Int, t * (length(rng)-1))], ts)) + # end end x := newx @@ -380,10 +380,10 @@ end if fr != nothing fillrange := newfr end - if lz != nothing - line_z := newlz - linecolor := (isa(d[:linecolor], ColorGradient) ? d[:linecolor] : cgrad()) - end + # if lz != nothing + # # line_z := newlz + # linecolor := (isa(d[:linecolor], ColorGradient) ? d[:linecolor] : cgrad()) + # end # Plots.DD(d) () end