gr: changed heatmap code

This commit is contained in:
Josef Heinen 2016-10-11 15:03:31 +02:00
parent 702ab3c504
commit 93e7bc2a2e

View File

@ -816,18 +816,19 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
cmap && gr_colorbar(sp) cmap && gr_colorbar(sp)
elseif st == :heatmap elseif st == :heatmap
# z = vec(transpose_z(series, z.surf, false))
zmin, zmax = gr_lims(zaxis, true) zmin, zmax = gr_lims(zaxis, true)
data = (float(z) - zmin) / (zmax - zmin)
clims = sp[:clims] clims = sp[:clims]
if is_2tuple(clims) if is_2tuple(clims)
isfinite(clims[1]) && (zmin = clims[1]) isfinite(clims[1]) && (zmin = clims[1])
isfinite(clims[2]) && (zmax = clims[2]) isfinite(clims[2]) && (zmax = clims[2])
end end
GR.setspace(zmin, zmax, 0, 90) data = [if zmin<=d<=zmax 1000 + d * 255 else 0 end for d in data]
# GR.surface(x, y, z, GR.OPTION_COLORED_MESH) data = round(Int32, data)
# GR.surface(x, y, z, GR.OPTION_HEATMAP) xmin, xmax = gr_lims(xaxis, false)
# gr_nans_to_infs!(z) ymin, ymax = gr_lims(yaxis, false)
GR.surface(x, y, z, GR.OPTION_CELL_ARRAY) width, height = length(x), length(y)
GR.cellarray(xmin, xmax, ymin, ymax, width, height, data)
cmap && gr_colorbar(sp) cmap && gr_colorbar(sp)
elseif st in (:path3d, :scatter3d) elseif st in (:path3d, :scatter3d)