Skip to content

Commit 970d479

Browse files
committed
Merge pull request #548 from plotly/heatmap-zsmooth-bug
Heatmap: Fix render bug when `zsmooth: 'fast'`
2 parents 716a621 + 0ca4b3a commit 970d479

File tree

5 files changed

+132
-2
lines changed

5 files changed

+132
-2
lines changed

src/traces/heatmap/plot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ function plotOne(gd, plotinfo, cd) {
323323
for(j = 0; j < m; j++) {
324324
row = z[j];
325325
yb = ypx(j);
326-
for(i = 0; i < n; i++) {
326+
for(i = 0; i < imageWidth; i++) {
327327
c = setColor(row[i], 1);
328328
pxIndex = (yb * imageWidth + xpx(i)) * 4;
329329
putColor(pixels, pxIndex, c);
69.3 KB
Loading
67.2 KB
Loading

test/image/mocks/Earth_heatmap.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2604,7 +2604,8 @@
26042604
]
26052605
],
26062606
"scl": "Earth",
2607-
"type": "heatmap"
2607+
"type": "heatmap",
2608+
"zsmooth": "fast"
26082609
}
26092610
],
26102611
"layout": {

test/image/mocks/zsmooth_methods.json

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{
2+
"data": [
3+
{
4+
"z": [
5+
[
6+
0.1189977,
7+
0.3403857,
8+
0.7512671,
9+
0.6990767,
10+
0.5472155
11+
],
12+
[
13+
0.4983641,
14+
0.5852678,
15+
0.2550951,
16+
0.8909033,
17+
0.1386244
18+
],
19+
[
20+
0.959744,
21+
0.2238119,
22+
0.5059571,
23+
0.9592914,
24+
0.149294
25+
]
26+
],
27+
"scl": "Jet",
28+
"zsmooth": "best",
29+
"type": "heatmap",
30+
"xaxis": "x",
31+
"yaxis": "y"
32+
},
33+
{
34+
"z": [
35+
[
36+
0.1189977,
37+
0.3403857,
38+
0.7512671,
39+
0.6990767,
40+
0.5472155
41+
],
42+
[
43+
0.4983641,
44+
0.5852678,
45+
0.2550951,
46+
0.8909033,
47+
0.1386244
48+
],
49+
[
50+
0.959744,
51+
0.2238119,
52+
0.5059571,
53+
0.9592914,
54+
0.149294
55+
]
56+
],
57+
"scl": "Jet",
58+
"zsmooth": "fast",
59+
"type": "heatmap",
60+
"xaxis": "x2",
61+
"yaxis": "y2"
62+
},
63+
{
64+
"z": [
65+
[
66+
0.1189977,
67+
0.3403857,
68+
0.7512671,
69+
0.6990767,
70+
0.5472155
71+
],
72+
[
73+
0.4983641,
74+
0.5852678,
75+
0.2550951,
76+
0.8909033,
77+
0.1386244
78+
],
79+
[
80+
0.959744,
81+
0.2238119,
82+
0.5059571,
83+
0.9592914,
84+
0.149294
85+
]
86+
],
87+
"scl": "Jet",
88+
"zsmooth": false,
89+
"type": "heatmap",
90+
"xaxis": "x3",
91+
"yaxis": "y3"
92+
}
93+
],
94+
"layout": {
95+
"title": "zsmooth: best, fast, false",
96+
"width": 800,
97+
"height": 350,
98+
"xaxis": {
99+
"domain": [
100+
0,
101+
0.31
102+
],
103+
"anchor": "y"
104+
},
105+
"yaxis": {
106+
"anchor": "x"
107+
},
108+
"xaxis2": {
109+
"domain": [
110+
0.35,
111+
0.64
112+
],
113+
"anchor": "y2"
114+
},
115+
"yaxis2": {
116+
"anchor": "x2"
117+
},
118+
"xaxis3": {
119+
"domain": [
120+
0.68,
121+
1
122+
],
123+
"anchor": "y3"
124+
},
125+
"yaxis3": {
126+
"anchor": "x3"
127+
}
128+
}
129+
}

0 commit comments

Comments
 (0)