Merge pull request #1089 from daschw/pyplot-colorbar

activate clims for inactive colorbar in pyplot
This commit is contained in:
Daniel Schwabeneder 2017-09-15 20:04:57 +02:00 committed by GitHub
commit 0f1d8478ce

View File

@ -445,7 +445,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
# handle zcolor and get c/cmap # handle zcolor and get c/cmap
needs_colorbar = hascolorbar(sp) needs_colorbar = hascolorbar(sp)
extrakw = if needs_colorbar extrakw = if needs_colorbar || is_2tuple(sp[:clims])
vmin, vmax = get_clims(sp) vmin, vmax = get_clims(sp)
KW(:vmin => vmin, :vmax => vmax) KW(:vmin => vmin, :vmax => vmax)
else else
@ -530,7 +530,6 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
lc lc
end end
push!(handles, handle) push!(handles, handle)
needs_colorbar = true
end end
a = series[:arrow] a = series[:arrow]
@ -628,12 +627,10 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
extrakw... extrakw...
) )
push!(handles, handle) push!(handles, handle)
needs_colorbar = true
end end
if st in (:contour, :contour3d) if st in (:contour, :contour3d)
z = transpose_z(series, z.surf) z = transpose_z(series, z.surf)
needs_colorbar = true
if st == :contour3d if st == :contour3d
extrakw[:extend3d] = true extrakw[:extend3d] = true
@ -678,7 +675,6 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
else else
extrakw[:cmap] = py_fillcolormap(series) extrakw[:cmap] = py_fillcolormap(series)
end end
needs_colorbar = true
end end
handle = ax[st == :surface ? :plot_surface : :plot_wireframe](x, y, z; handle = ax[st == :surface ? :plot_surface : :plot_wireframe](x, y, z;
label = series[:label], label = series[:label],
@ -701,7 +697,6 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
offset = (zdir == "y" ? ignorenan_maximum : ignorenan_minimum)(mat) # where to draw the contour plane offset = (zdir == "y" ? ignorenan_maximum : ignorenan_minimum)(mat) # where to draw the contour plane
) )
push!(handles, handle) push!(handles, handle)
needs_colorbar = true
end end
end end
@ -722,7 +717,6 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
extrakw... extrakw...
) )
push!(handles, handle) push!(handles, handle)
needs_colorbar = true
else else
error("Unsupported z type $(typeof(z)) for seriestype=$st") error("Unsupported z type $(typeof(z)) for seriestype=$st")
end end
@ -770,7 +764,6 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
extrakw... extrakw...
) )
push!(handles, handle) push!(handles, handle)
needs_colorbar = true
end end
if st == :shape if st == :shape