Skip to content

Commit b6d5283

Browse files
authored
Merge pull request #3011 from plotly/2881-scatter3d-fix-errorbars
scatter3d display errorbars when error_z is not specified
2 parents ed39d82 + 7542e6f commit b6d5283

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

Diff for: src/traces/scatter3d/convert.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,17 @@ function constructDelaunay(points, color, axis) {
116116
function calculateErrorParams(errors) {
117117
var capSize = [0.0, 0.0, 0.0],
118118
color = [[0, 0, 0], [0, 0, 0], [0, 0, 0]],
119-
lineWidth = [0.0, 0.0, 0.0];
119+
lineWidth = [1.0, 1.0, 1.0];
120120

121121
for(var i = 0; i < 3; i++) {
122122
var e = errors[i];
123123

124-
if(e && e.copy_zstyle !== false) e = errors[2];
125-
if(!e) continue;
124+
if(e && e.copy_zstyle !== false && errors[2].visible !== false) e = errors[2];
125+
if(!e || !e.visible) continue;
126126

127127
capSize[i] = e.width / 2; // ballpark rescaling
128128
color[i] = str2RgbaArray(e.color);
129-
lineWidth = e.thickness;
129+
lineWidth[i] = e.thickness;
130130

131131
}
132132

Diff for: test/image/baselines/gl3d_errorbars_xy.png

21.4 KB
Loading

Diff for: test/image/mocks/gl3d_errorbars_xy.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"data": [{
3+
"type": "scatter3d",
4+
"mode": "markers",
5+
"x": [5, 10],
6+
"y": [5, 10],
7+
"z": [5, 10],
8+
"error_x": {
9+
"type": "sqrt",
10+
"color": "red"
11+
},
12+
"error_y": {
13+
"type": "sqrt"
14+
}
15+
}],
16+
"layout": {}
17+
}

Diff for: test/image/mocks/gl3d_errorbars_zx.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"error_x": {
3636
"type": "constant",
3737
"value": 0.1,
38-
"color": "black"
38+
"color": "black",
39+
"thickness": 10
3940
},
4041
"marker": {
4142
"symbol": "square"

0 commit comments

Comments
 (0)