Skip to content

Commit 771b904

Browse files
Refactor UpdateErrorbar
1 parent efa4e91 commit 771b904

File tree

3 files changed

+26
-37
lines changed

3 files changed

+26
-37
lines changed

plotly/Test_plotlyfig.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ function testErrorbarData(tc)
967967
"showlegend", false, ...
968968
"error_y", struct( ...
969969
"visible", true, ...
970-
"type", 'data', ...
970+
"type", "data", ...
971971
"symmetric", false, ...
972972
"array", err, ...
973973
"arrayminus", err, ...
@@ -977,7 +977,7 @@ function testErrorbarData(tc)
977977
), ...
978978
"error_x", struct( ...
979979
"visible", true, ...
980-
"type", 'data', ...
980+
"type", "data", ...
981981
"array", zeros(1,0), ...
982982
"arrayminus", zeros(1,0), ...
983983
"thickness", 0.5, ...

plotly/plotlyfig_aux/core/updateData.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
case "functioncontour"
126126
obj.data{dataIndex} = updateFunctionContour(obj,dataIndex);
127127
case "errorbar"
128-
updateErrorbar(obj,dataIndex);
128+
obj.data{dataIndex} = updateErrorbar(obj,dataIndex);
129129
case "errorbarseries"
130130
updateErrorbarseries(obj,dataIndex);
131131
case "lineseries"
Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,28 @@
1-
function obj = updateErrorbar(obj, plotIndex)
2-
%-INITIALIZATION-%
3-
1+
function data = updateErrorbar(obj, plotIndex)
42
%-get data structures-%
53
plotData = obj.State.Plot(plotIndex).Handle;
64

7-
%-get error data-%
8-
yPositiveDelta = plotData.YPositiveDelta;
9-
yNegativeDelta = plotData.YNegativeDelta;
10-
11-
xPositiveDelta = plotData.XPositiveDelta;
12-
xNegativeDelta = plotData.XNegativeDelta;
13-
145
%-set trace-%
15-
obj.data{plotIndex} = updateLineseries(obj, plotIndex);
16-
17-
obj.data{plotIndex}.error_y.visible = true;
18-
obj.data{plotIndex}.error_x.visible = true;
19-
obj.data{plotIndex}.error_y.type = 'data';
20-
obj.data{plotIndex}.error_x.type = 'data';
21-
22-
obj.data{plotIndex}.error_y.symmetric = false;
23-
24-
obj.data{plotIndex}.error_y.array = yPositiveDelta;
25-
obj.data{plotIndex}.error_x.array = xPositiveDelta;
26-
obj.data{plotIndex}.error_x.arrayminus = xNegativeDelta;
27-
obj.data{plotIndex}.error_y.arrayminus = yNegativeDelta;
28-
29-
obj.data{plotIndex}.error_y.thickness = plotData.LineWidth;
30-
obj.data{plotIndex}.error_x.thickness = plotData.LineWidth;
31-
32-
obj.data{plotIndex}.error_y.width = obj.PlotlyDefaults.ErrorbarWidth;
33-
obj.data{plotIndex}.error_x.width = obj.PlotlyDefaults.ErrorbarWidth;
34-
35-
%-errorbar color-%
36-
errorColor = getStringColor(round(255*plotData.Color));
37-
obj.data{plotIndex}.error_y.color = errorColor;
38-
obj.data{plotIndex}.error_x.color = errorColor;
6+
data = updateLineseries(obj, plotIndex);
7+
8+
data.error_y = struct( ...
9+
"visible", true, ...
10+
"type", "data", ...
11+
"array", plotData.YPositiveDelta, ...
12+
"arrayminus", plotData.YNegativeDelta, ...
13+
"thickness", plotData.LineWidth, ...
14+
"width", obj.PlotlyDefaults.ErrorbarWidth, ...
15+
"color", getStringColor(round(255*plotData.Color)), ...
16+
"symmetric", false ...
17+
);
18+
19+
data.error_x = struct( ...
20+
"visible", true, ...
21+
"type", "data", ...
22+
"array", plotData.XPositiveDelta, ...
23+
"arrayminus", plotData.XNegativeDelta, ...
24+
"thickness", plotData.LineWidth, ...
25+
"width", obj.PlotlyDefaults.ErrorbarWidth, ...
26+
"color", getStringColor(round(255*plotData.Color)) ...
27+
);
3928
end

0 commit comments

Comments
 (0)