From 93e7bc2a2e249a1328ef5e7d6346ff4a45130e67 Mon Sep 17 00:00:00 2001 From: Josef Heinen Date: Tue, 11 Oct 2016 15:03:31 +0200 Subject: [PATCH] gr: changed heatmap code --- src/backends/gr.jl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 91b4855d..6f2706bd 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -816,18 +816,19 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) cmap && gr_colorbar(sp) elseif st == :heatmap - # z = vec(transpose_z(series, z.surf, false)) zmin, zmax = gr_lims(zaxis, true) + data = (float(z) - zmin) / (zmax - zmin) clims = sp[:clims] if is_2tuple(clims) isfinite(clims[1]) && (zmin = clims[1]) isfinite(clims[2]) && (zmax = clims[2]) end - GR.setspace(zmin, zmax, 0, 90) - # GR.surface(x, y, z, GR.OPTION_COLORED_MESH) - # GR.surface(x, y, z, GR.OPTION_HEATMAP) - # gr_nans_to_infs!(z) - GR.surface(x, y, z, GR.OPTION_CELL_ARRAY) + data = [if zmin<=d<=zmax 1000 + d * 255 else 0 end for d in data] + data = round(Int32, data) + xmin, xmax = gr_lims(xaxis, false) + ymin, ymax = gr_lims(yaxis, false) + width, height = length(x), length(y) + GR.cellarray(xmin, xmax, ymin, ymax, width, height, data) cmap && gr_colorbar(sp) elseif st in (:path3d, :scatter3d)