fix pyplot heatmap; closes #388

This commit is contained in:
Thomas Breloff 2016-08-10 14:32:54 -04:00
parent 23b25d4954
commit e164a8274a

View File

@ -713,9 +713,9 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
if st == :heatmap if st == :heatmap
x, y, z = heatmap_edges(x), heatmap_edges(y), transpose_z(series, z.surf) x, y, z = heatmap_edges(x), heatmap_edges(y), transpose_z(series, z.surf)
# if !(eltype(z) <: Number)
# z, discrete_colorbar_values = indices_and_unique_values(z) expand_extrema!(sp[:xaxis], x)
# end expand_extrema!(sp[:yaxis], y)
dvals = sp[:zaxis][:discrete_values] dvals = sp[:zaxis][:discrete_values]
if !isempty(dvals) if !isempty(dvals)
discrete_colorbar_values = dvals discrete_colorbar_values = dvals
@ -731,21 +731,11 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
label = series[:label], label = series[:label],
zorder = series[:series_plotindex], zorder = series[:series_plotindex],
cmap = py_fillcolormap(series), cmap = py_fillcolormap(series),
edgecolors = (series[:linewidth] > 0 ? py_linecolor(series) : "face"), # edgecolors = (series[:linewidth] > 0 ? py_linecolor(series) : "face"),
extrakw... extrakw...
) )
push!(handles, handle) push!(handles, handle)
needs_colorbar = true needs_colorbar = true
# TODO: this should probably be handled generically
# expand extrema... handle is a QuadMesh object
for path in handle[:properties]()["paths"]
verts = path[:vertices]
xmin, ymin = minimum(verts, 1)
xmax, ymax = maximum(verts, 1)
expand_extrema!(sp, xmin, xmax, ymin, ymax)
end
end end
if st == :shape if st == :shape