Skip to content

Commit 2ec8330

Browse files
Format and delete commented out code
1 parent 9f6700f commit 2ec8330

31 files changed

+67
-626
lines changed

Diff for: plotly/plotlyfig_aux/core/updateHeatmapAnnotation.m

+6-32
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
% titlefont.color...[DONE]
77

88
%------ANNOTATION FIELDS-------%
9-
109
% x: ...[DONE]
1110
% y: ...[DONE]
1211
% xref: ...[DONE]
@@ -30,7 +29,6 @@
3029
% bgcolor: ...[DONE]
3130
% opacity: ...[NOT SUPPORTED IN MATLAB]
3231

33-
3432
%-AXIS INDEX-%
3533
nanns = length(obj.layout.annotations);
3634
axIndex = nanns + obj.getAxisIndex(obj.State.Text(anIndex).AssociatedAxis);
@@ -44,54 +42,30 @@
4442
%-show arrow-%
4543
obj.layout.annotations{axIndex}.showarrow = false;
4644

47-
%---------------------------------------------------------------------%
48-
4945
%-anchor title to paper-%
5046
if obj.State.Text(anIndex).Title
51-
%-xref-%
52-
obj.layout.annotations{axIndex}.xref = 'paper';
53-
%-yref-%
54-
obj.layout.annotations{axIndex}.yref = 'paper';
47+
obj.layout.annotations{axIndex}.xref = "paper";
48+
obj.layout.annotations{axIndex}.yref = "paper";
5549
else
56-
%-xref-%
5750
obj.layout.annotations{axIndex}.xref = "x" + xsource;
58-
%-yref-%
5951
obj.layout.annotations{axIndex}.yref = "y" + ysource;
6052
end
6153

62-
%---------------------------------------------------------------------%
63-
64-
%-xanchor-%
65-
obj.layout.annotations{axIndex}.xanchor = 'middle';
66-
67-
%-align-%
68-
obj.layout.annotations{axIndex}.align = 'middle';
69-
70-
%-xanchor-%
71-
obj.layout.annotations{axIndex}.yanchor = 'top';
72-
73-
74-
%---------------------------------------------------------------------%
75-
76-
%-text-%
77-
obj.layout.annotations{axIndex}.text = sprintf('<b>%s</b>', title_name);
54+
obj.layout.annotations{axIndex}.xanchor = "middle";
55+
obj.layout.annotations{axIndex}.align = "middle";
56+
obj.layout.annotations{axIndex}.yanchor = "top";
57+
obj.layout.annotations{axIndex}.text = sprintf("<b>%s</b>", title_name);
7858
obj.layout.annotations{axIndex}.font.size = 14;
7959

80-
%---------------------------------------------------------------------%
81-
8260
if obj.State.Text(anIndex).Title
8361
%-AXIS DATA-%
8462
xaxis = obj.layout.("xaxis" + xsource);
8563
yaxis = obj.layout.("yaxis" + ysource);
8664

87-
%-x position-%
8865
obj.layout.annotations{axIndex}.x = mean(xaxis.domain);
89-
%-y position-%
9066
obj.layout.annotations{axIndex}.y = (yaxis.domain(2) + 0.04);
9167
else
92-
%-x position-%
9368
obj.layout.annotations{axIndex}.x = text_data.Position(1);
94-
%-y position-%
9569
obj.layout.annotations{axIndex}.y = text_data.Position(2);
9670
end
9771
end

Diff for: plotly/plotlyfig_aux/handlegraphics/updateArea.m

-10
Original file line numberDiff line numberDiff line change
@@ -114,27 +114,17 @@ function updateArea(obj,areaIndex)
114114

115115
%---------------------------------------------------------------------%
116116

117-
%-area line-%
118117
obj.data{areaIndex}.line = extractAreaLine(area_data);
119-
120-
%---------------------------------------------------------------------%
121-
122-
%-area fillcolor-%
123118
fill = extractAreaFace(area_data);
124119
obj.data{areaIndex}.fillcolor = fill.color;
125120

126-
%---------------------------------------------------------------------%
127-
128-
%-area showlegend-%
129121
leg = area_data.Annotation;
130122
legInfo = leg.LegendInformation;
131-
132123
switch legInfo.IconDisplayStyle
133124
case "on"
134125
showleg = true;
135126
case "off"
136127
showleg = false;
137128
end
138-
139129
obj.data{areaIndex}.showlegend = showleg;
140130
end

Diff for: plotly/plotlyfig_aux/handlegraphics/updateBar3.m

+18-19
Original file line numberDiff line numberDiff line change
@@ -135,26 +135,17 @@
135135

136136
%---------------------------------------------------------------------%
137137

138-
%-surface name-%
139138
obj.data{surfaceIndex}.name = bar_data.DisplayName;
140-
141-
%---------------------------------------------------------------------%
142-
143-
%-surface visible-%
144139
obj.data{surfaceIndex}.visible = strcmp(bar_data.Visible, 'on');
145140

146-
%---------------------------------------------------------------------%
147-
148141
leg = bar_data.Annotation;
149142
legInfo = leg.LegendInformation;
150-
151143
switch legInfo.IconDisplayStyle
152144
case 'on'
153145
showleg = true;
154146
case 'off'
155147
showleg = false;
156148
end
157-
158149
obj.data{surfaceIndex}.showlegend = showleg;
159150

160151
%---------------------------------------------------------------------%
@@ -246,9 +237,11 @@
246237
end
247238

248239
function bar_ = bar_data(position3d, size_)
249-
% position3d - 3-list or array of shape (3,) that represents the point of coords (x, y, 0), where a bar is placed
250-
% size = a 3-tuple whose elements are used to scale a unit cube to get a paralelipipedic bar
251-
% returns - an array of shape(8,3) representing the 8 vertices of a bar at position3d
240+
% position3d - 3-list or array of shape (3,) that represents the point
241+
% of coords (x, y, 0), where a bar is placed size = a 3-tuple whose
242+
% elements are used to scale a unit cube to get a paralelipipedic bar
243+
% returns - an array of shape(8,3) representing the 8 vertices of a bar
244+
% at position3d
252245

253246
if nargin < 2
254247
size_ = [1, 1, 1];
@@ -265,7 +258,7 @@
265258
0, 1, 1 ...
266259
]; % the vertices of the unit cube
267260

268-
for n =1:size(bar_, 1)
261+
for n = 1:size(bar_, 1)
269262
% scale the cube to get the vertices of a parallelipipedic bar_
270263
bar_(n,:) = bar_(n,:) .* size_;
271264
end
@@ -283,7 +276,7 @@
283276
% used in instantiating the go.Mesh3d class.
284277

285278
if nargin < 2
286-
sizes = ones(size(positions,1), 3); %[(1,1,1)]*len(positions)
279+
sizes = ones(size(positions,1), 3); % [(1,1,1)]*len(positions)
287280
end
288281

289282
c = 1;
@@ -294,24 +287,30 @@
294287
end
295288
end
296289

297-
% all_bars = [bar_data(pos, size) for pos, size in zip(positions, sizes) if size[2]!=0]
290+
% all_bars = [bar_data(pos, size) for pos, size in
291+
% zip(positions, sizes) if size[2]!=0]
298292
[r, q, p] = size(all_bars);
299293

300294
% extract unique vertices from the list of all bar vertices
301295
all_bars = reshape(all_bars, [r, p*q])';
302296
[vertices, ~, ixr] = unique(all_bars, 'rows');
303297

304-
%for each bar, derive the sublists of indices i, j, k assocated to its chosen triangulation
298+
% for each bar, derive the sublists of indices i, j, k assocated to its
299+
% chosen triangulation
305300
I = [];
306301
J = [];
307302
K = [];
308303

309304
for k = 0:p-1
310-
aux = ixr([1+8*k, 1+8*k+2,1+8*k, 1+8*k+5,1+8*k, 1+8*k+7, 1+8*k+5, 1+8*k+2, 1+8*k+3, 1+8*k+6, 1+8*k+7, 1+8*k+5]);
305+
aux = ixr([1+8*k, 1+8*k+2,1+8*k, 1+8*k+5,1+8*k, 1+8*k+7, ...
306+
1+8*k+5, 1+8*k+2, 1+8*k+3, 1+8*k+6, 1+8*k+7, 1+8*k+5]);
311307
I = [ I; aux(:)];
312-
aux = ixr([1+8*k+1, 1+8*k+3, 1+8*k+4, 1+8*k+1, 1+8*k+3, 1+8*k+4, 1+8*k+1, 1+8*k+6, 1+8*k+7, 1+8*k+2, 1+8*k+4, 1+8*k+6]);
308+
aux = ixr([1+8*k+1, 1+8*k+3, 1+8*k+4, 1+8*k+1, 1+8*k+3, ...
309+
1+8*k+4, 1+8*k+1, 1+8*k+6, 1+8*k+7, 1+8*k+2, 1+8*k+4, ...
310+
1+8*k+6]);
313311
J = [ J; aux(:)];
314-
aux = ixr([1+8*k+2, 1+8*k, 1+8*k+5, 1+8*k, 1+8*k+7, 1+8*k, 1+8*k+2, 1+8*k+5, 1+8*k+6, 1+8*k+3, 1+8*k+5, 1+8*k+7]);
312+
aux = ixr([1+8*k+2, 1+8*k, 1+8*k+5, 1+8*k, 1+8*k+7, 1+8*k, ...
313+
1+8*k+2, 1+8*k+5, 1+8*k+6, 1+8*k+3, 1+8*k+5, 1+8*k+7]);
315314
K = [ K; aux(:)];
316315
end
317316

Diff for: plotly/plotlyfig_aux/handlegraphics/updateBar3h.m

+12-7
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@
299299
end
300300
end
301301

302-
% all_bars = [bar_data(pos, size) for pos, size in zip(positions, sizes) if size[2]!=0]
302+
% all_bars = [bar_data(pos, size) for pos, size in
303+
% zip(positions, sizes) if size[2]!=0]
303304
[r, q, p] = size(all_bars);
304305

305306
% extract unique vertices from the list of all bar vertices
@@ -312,12 +313,16 @@
312313
K = [];
313314

314315
for k = 0:p-1
315-
aux = ixr([1+8*k, 1+8*k+2,1+8*k, 1+8*k+5,1+8*k, 1+8*k+7, 1+8*k+5, 1+8*k+2, 1+8*k+3, 1+8*k+6, 1+8*k+7, 1+8*k+5]);
316-
I = [ I; aux(:)];
317-
aux = ixr([1+8*k+1, 1+8*k+3, 1+8*k+4, 1+8*k+1, 1+8*k+3, 1+8*k+4, 1+8*k+1, 1+8*k+6, 1+8*k+7, 1+8*k+2, 1+8*k+4, 1+8*k+6]);
318-
J = [ J; aux(:)];
319-
aux = ixr([1+8*k+2, 1+8*k, 1+8*k+5, 1+8*k, 1+8*k+7, 1+8*k, 1+8*k+2, 1+8*k+5, 1+8*k+6, 1+8*k+3, 1+8*k+5, 1+8*k+7]);
320-
K = [ K; aux(:)];
316+
aux = ixr([1+8*k, 1+8*k+2,1+8*k, 1+8*k+5,1+8*k, 1+8*k+7, ...
317+
1+8*k+5, 1+8*k+2, 1+8*k+3, 1+8*k+6, 1+8*k+7, 1+8*k+5]);
318+
I = [I; aux(:)];
319+
aux = ixr([1+8*k+1, 1+8*k+3, 1+8*k+4, 1+8*k+1, 1+8*k+3, ...
320+
1+8*k+4, 1+8*k+1, 1+8*k+6, 1+8*k+7, 1+8*k+2, 1+8*k+4, ...
321+
1+8*k+6]);
322+
J = [J; aux(:)];
323+
aux = ixr([1+8*k+2, 1+8*k, 1+8*k+5, 1+8*k, 1+8*k+7, 1+8*k, ...
324+
1+8*k+2, 1+8*k+5, 1+8*k+6, 1+8*k+3, 1+8*k+5, 1+8*k+7]);
325+
K = [K; aux(:)];
321326
end
322327

323328
end

Diff for: plotly/plotlyfig_aux/handlegraphics/updateBarseries.m

-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
% smoothing: ...[NA]
5151
% outliercolor: ...[NA]
5252
% outlierwidth: ...[NA]
53-
5453
%---------------------------------------------------------------------%
5554

5655
%-AXIS INDEX-%
@@ -93,12 +92,10 @@
9392
switch bar_data.Horizontal
9493
case 'off'
9594
obj.data{barIndex}.orientation = 'v';
96-
%-bar x and y data-%
9795
obj.data{barIndex}.x = bar_data.XData;
9896
obj.data{barIndex}.y = bar_data.YData;
9997
case 'on'
10098
obj.data{barIndex}.orientation = 'h';
101-
%-bar x and y data-%
10299
obj.data{barIndex}.x = bar_data.YData;
103100
obj.data{barIndex}.y = bar_data.XData;
104101
end

Diff for: plotly/plotlyfig_aux/handlegraphics/updateCategoricalHistogram.m

+1-34
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,9 @@
6262

6363
%---------------------------------------------------------------------%
6464

65-
%-hist xaxis and yaxis-%
6665
obj.data{histIndex}.xaxis = "x" + xsource;
6766
obj.data{histIndex}.yaxis = "y" + ysource;
68-
69-
%---------------------------------------------------------------------%
70-
71-
%-bar type-%
7267
obj.data{histIndex}.type = 'bar';
73-
74-
%---------------------------------------------------------------------%
75-
76-
%-hist data-%
7768
obj.data{histIndex}.width = hist_data.BarWidth;
7869
obj.data{histIndex}.y = hist_data.Values;
7970

@@ -84,54 +75,30 @@
8475
xmin = -gap;
8576
xmax = (hist_data.NumDisplayBins - 1) + gap;
8677

87-
t = 'category';
88-
obj.layout.("xaxis" + xsource).type = t;
78+
obj.layout.("xaxis" + xsource).type = 'category';
8979
obj.layout.("xaxis" + xsource).autotick = false;
9080
obj.layout.("xaxis" + xsource).range = {xmin, xmax};
9181

9282
%---------------------------------------------------------------------%
9383

94-
%-hist name-%
9584
obj.data{histIndex}.name = hist_data.DisplayName;
96-
97-
%---------------------------------------------------------------------%
98-
99-
%-layout barmode-%
10085
obj.layout.barmode = 'group';
101-
102-
%---------------------------------------------------------------------%
103-
104-
%-hist line width-%
10586
obj.data{histIndex}.marker.line.width = hist_data.LineWidth;
10687

107-
%---------------------------------------------------------------------%
108-
109-
%-hist opacity-%
11088
if ~ischar(hist_data.FaceAlpha)
11189
obj.data{histIndex}.opacity = 1.25*hist_data.FaceAlpha;
11290
end
11391

114-
%---------------------------------------------------------------------%
115-
11692
obj.data{histIndex}.marker = extractPatchFace(hist_data);
117-
118-
%---------------------------------------------------------------------%
119-
120-
%-hist visible-%
12193
obj.data{histIndex}.visible = strcmp(hist_data.Visible,'on');
12294

123-
%---------------------------------------------------------------------%
124-
125-
%-hist showlegend-%
12695
leg = hist_data.Annotation;
12796
legInfo = leg.LegendInformation;
128-
12997
switch legInfo.IconDisplayStyle
13098
case 'on'
13199
showleg = true;
132100
case 'off'
133101
showleg = false;
134102
end
135-
136103
obj.data{histIndex}.showlegend = showleg;
137104
end

0 commit comments

Comments
 (0)