fix recipe error

This commit is contained in:
Daniel Schwabeneder 2019-05-02 12:48:06 +02:00
parent e860ba220a
commit 65173e6dd2
3 changed files with 14 additions and 10 deletions

View File

@ -784,7 +784,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
tbx, tby = gr_inqtext(0, 0, string(lab)) tbx, tby = gr_inqtext(0, 0, string(lab))
legendw = max(legendw, tbx[3] - tbx[1]) legendw = max(legendw, tbx[3] - tbx[1])
end end
GR.setscale(1) GR.setscale(1)
GR.selntran(1) GR.selntran(1)
GR.restorestate() GR.restorestate()
@ -1139,7 +1139,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
end end
if st in (:path, :scatter, :straightline) if st in (:path, :scatter, :straightline)
if length(x) > 1 if x != nothing && length(x) > 1
lz = series[:line_z] lz = series[:line_z]
segments = iter_segments(series) segments = iter_segments(series)
# do area fill # do area fill

View File

@ -216,13 +216,15 @@ end
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
function fix_xy_lengths!(plt::Plot{PyPlotBackend}, series::Series) function fix_xy_lengths!(plt::Plot{PyPlotBackend}, series::Series)
x, y = series[:x], series[:y] if series[:x] != nothing
nx, ny = length(x), length(y) x, y = series[:x], series[:y]
if !isa(get(series.plotattributes, :z, nothing), Surface) && nx != ny nx, ny = length(x), length(y)
if nx < ny if !isa(get(series.plotattributes, :z, nothing), Surface) && nx != ny
series[:x] = Float64[x[mod1(i,nx)] for i=1:ny] if nx < ny
else series[:x] = Float64[x[mod1(i,nx)] for i=1:ny]
series[:y] = Float64[y[mod1(i,ny)] for i=1:nx] else
series[:y] = Float64[y[mod1(i,ny)] for i=1:nx]
end
end end
end end
end end

View File

@ -194,7 +194,9 @@ end
function iter_segments(series::Series) function iter_segments(series::Series)
x, y, z = series[:x], series[:y], series[:z] x, y, z = series[:x], series[:y], series[:z]
if has_attribute_segments(series) if x == nothing
return UnitRange{Int}[]
elseif has_attribute_segments(series)
if series[:seriestype] in (:scatter, :scatter3d) if series[:seriestype] in (:scatter, :scatter3d)
return [[i] for i in 1:length(y)] return [[i] for i in 1:length(y)]
else else