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

View File

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

View File

@ -194,7 +194,9 @@ end
function iter_segments(series::Series)
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)
return [[i] for i in 1:length(y)]
else