diff --git a/src/traces/heatmap/plot.js b/src/traces/heatmap/plot.js index 3162c86069e..a4f7ac2c0e7 100644 --- a/src/traces/heatmap/plot.js +++ b/src/traces/heatmap/plot.js @@ -323,7 +323,7 @@ function plotOne(gd, plotinfo, cd) { for(j = 0; j < m; j++) { row = z[j]; yb = ypx(j); - for(i = 0; i < n; i++) { + for(i = 0; i < imageWidth; i++) { c = setColor(row[i], 1); pxIndex = (yb * imageWidth + xpx(i)) * 4; putColor(pixels, pxIndex, c); diff --git a/test/image/baselines/Earth_heatmap.png b/test/image/baselines/Earth_heatmap.png index d5776d6dffd..bb1397cdbce 100644 Binary files a/test/image/baselines/Earth_heatmap.png and b/test/image/baselines/Earth_heatmap.png differ diff --git a/test/image/baselines/zsmooth_methods.png b/test/image/baselines/zsmooth_methods.png new file mode 100644 index 00000000000..4fcbf75279e Binary files /dev/null and b/test/image/baselines/zsmooth_methods.png differ diff --git a/test/image/mocks/Earth_heatmap.json b/test/image/mocks/Earth_heatmap.json index e94513e68dd..8c82e8e575e 100644 --- a/test/image/mocks/Earth_heatmap.json +++ b/test/image/mocks/Earth_heatmap.json @@ -2604,7 +2604,8 @@ ] ], "scl": "Earth", - "type": "heatmap" + "type": "heatmap", + "zsmooth": "fast" } ], "layout": { diff --git a/test/image/mocks/zsmooth_methods.json b/test/image/mocks/zsmooth_methods.json new file mode 100644 index 00000000000..5916d51b57a --- /dev/null +++ b/test/image/mocks/zsmooth_methods.json @@ -0,0 +1,129 @@ +{ + "data": [ + { + "z": [ + [ + 0.1189977, + 0.3403857, + 0.7512671, + 0.6990767, + 0.5472155 + ], + [ + 0.4983641, + 0.5852678, + 0.2550951, + 0.8909033, + 0.1386244 + ], + [ + 0.959744, + 0.2238119, + 0.5059571, + 0.9592914, + 0.149294 + ] + ], + "scl": "Jet", + "zsmooth": "best", + "type": "heatmap", + "xaxis": "x", + "yaxis": "y" + }, + { + "z": [ + [ + 0.1189977, + 0.3403857, + 0.7512671, + 0.6990767, + 0.5472155 + ], + [ + 0.4983641, + 0.5852678, + 0.2550951, + 0.8909033, + 0.1386244 + ], + [ + 0.959744, + 0.2238119, + 0.5059571, + 0.9592914, + 0.149294 + ] + ], + "scl": "Jet", + "zsmooth": "fast", + "type": "heatmap", + "xaxis": "x2", + "yaxis": "y2" + }, + { + "z": [ + [ + 0.1189977, + 0.3403857, + 0.7512671, + 0.6990767, + 0.5472155 + ], + [ + 0.4983641, + 0.5852678, + 0.2550951, + 0.8909033, + 0.1386244 + ], + [ + 0.959744, + 0.2238119, + 0.5059571, + 0.9592914, + 0.149294 + ] + ], + "scl": "Jet", + "zsmooth": false, + "type": "heatmap", + "xaxis": "x3", + "yaxis": "y3" + } + ], + "layout": { + "title": "zsmooth: best, fast, false", + "width": 800, + "height": 350, + "xaxis": { + "domain": [ + 0, + 0.31 + ], + "anchor": "y" + }, + "yaxis": { + "anchor": "x" + }, + "xaxis2": { + "domain": [ + 0.35, + 0.64 + ], + "anchor": "y2" + }, + "yaxis2": { + "anchor": "x2" + }, + "xaxis3": { + "domain": [ + 0.68, + 1 + ], + "anchor": "y3" + }, + "yaxis3": { + "anchor": "x3" + } + } +}