Skip to content

Commit ba4092d

Browse files
Replace set() with direct property access
1 parent 2ec8330 commit ba4092d

9 files changed

+57
-164
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242

4343
%-STANDARDIZE UNITS-%
4444
axisUnits = obj.State.Axis(axIndex).Handle.Units;
45-
set(obj.State.Axis(axIndex).Handle,'Units','normalized')
45+
obj.State.Axis(axIndex).Handle.Units = 'normalized';
4646

4747
try
4848
fontUnits = obj.State.Axis(axIndex).Handle.FontUnits;
49-
set(obj.State.Axis(axIndex).Handle,'FontUnits','points')
49+
obj.State.Axis(axIndex).Handle.FontUnits = 'points';
5050
catch
5151
% TODO
5252
end
@@ -172,10 +172,10 @@
172172
%---------------------------------------------------------------------%
173173

174174
%-REVERT UNITS-%
175-
set(obj.State.Axis(axIndex).Handle, 'Units', axisUnits);
175+
obj.State.Axis(axIndex).Handle.Units = axisUnits;
176176

177177
try
178-
set(obj.State.Axis(axIndex).Handle, 'FontUnits', fontUnits);
178+
obj.State.Axis(axIndex).Handle.FontUnits = fontUnits;
179179
catch
180180
% TODO
181181
end

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
%-STANDARDIZE UNITS-%
55
axisUnits = obj.State.Axis(axIndex).Handle.Units;
6-
set(obj.State.Axis(axIndex).Handle,'Units','normalized')
6+
obj.State.Axis(axIndex).Handle.Units = 'normalized';
77

88
try
99
fontUnits = obj.State.Axis(axIndex).Handle.FontUnits;
10-
set(obj.State.Axis(axIndex).Handle,'FontUnits','points')
10+
obj.State.Axis(axIndex).Handle.FontUnits = 'points';
1111
catch
1212
% TODO
1313
end
@@ -73,10 +73,10 @@
7373
%---------------------------------------------------------------------%
7474

7575
%-REVERT UNITS-%
76-
set(obj.State.Axis(axIndex).Handle,'Units',axisUnits);
76+
obj.State.Axis(axIndex).Handle.Units = axisUnits;
7777

7878
try
79-
set(obj.State.Axis(axIndex).Handle,'FontUnits',fontUnits);
79+
obj.State.Axis(axIndex).Handle.FontUnits = fontUnits;
8080
catch
8181
% TODO
8282
end

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

+16-23
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
%-STANDARDIZE UNITS-%
4545
colorbarUnits = colorbarData.Units;
46-
set(obj.State.Colorbar(colorbarIndex).Handle, 'Units', 'normalized');
46+
obj.State.Colorbar(colorbarIndex).Handle.Units = 'normalized';
4747

4848
%---------------------------------------------------------------------%
4949

@@ -120,15 +120,15 @@
120120
titlefontunits = colorbarTitleData.FontUnits;
121121
ylabelunits = colorbarYLabelData.Units;
122122
ylabelfontunits = colorbarYLabelData.FontUnits;
123-
set(colorbarTitle,'Units', 'data');
124-
set(colorbarYLabel,'Units', 'data');
125-
set(colorbarYLabel,'FontUnits', 'points');
123+
colorbarTitle.Units = 'data';
124+
colorbarYLabel.Units = 'data';
125+
colorbarYLabel.FontUnits = 'points';
126126
if ~isHG2
127127
xlabelunits = colorbarXLabelData.Units;
128128
xlabelfontunits = colorbarXLabelData.FontUnits;
129-
set(colorbarTitle,'FontUnits', 'points');
130-
set(colorbarXLabel,'Units', 'data');
131-
set(colorbarXLabel,'FontUnits', 'points');
129+
colorbarTitle.FontUnits = 'points';
130+
colorbarXLabel.Units = 'data';
131+
colorbarXLabel.FontUnits = 'points';
132132
end
133133

134134
%---------------------------------------------------------------------%
@@ -150,7 +150,6 @@
150150
titleFontColor = sprintf("rgb(%d,%d,%d)", ...
151151
round(255*colorbarTitleData.Color));
152152
titleFontFamily = matlab2plotlyfont(colorbarTitleData.FontName);
153-
154153
elseif ~isempty(colorbarXLabelData.String)
155154
titleString = colorbarXLabelData.String;
156155
titleInterpreter = colorbarXLabelData.Interpreter;
@@ -160,7 +159,6 @@
160159
titleFontColor = sprintf("rgb(%d,%d,%d)", ...
161160
round(255*colorbarXLabelData.Color));
162161
titleFontFamily = matlab2plotlyfont(colorbarXLabelData.FontName);
163-
164162
elseif ~isempty(colorbarYLabelData.String)
165163
titleString = colorbarYLabelData.String;
166164
titleInterpreter = colorbarYLabelData.Interpreter;
@@ -170,7 +168,6 @@
170168
titleFontColor = sprintf("rgb(%d,%d,%d)", ...
171169
round(255*colorbarYLabelData.Color));
172170
titleFontFamily = matlab2plotlyfont(colorbarYLabelData.FontName);
173-
174171
else
175172
isTitle = false;
176173
end
@@ -186,14 +183,14 @@
186183
%---------------------------------------------------------------------%
187184

188185
%-REVERT UNITS FOR TITLE-%
189-
set(colorbarTitle,'Units', titleunits);
190-
set(colorbarTitle,'FontUnits', titlefontunits);
191-
set(colorbarYLabel,'Units', ylabelunits);
192-
set(colorbarYLabel,'FontUnits', ylabelfontunits);
186+
colorbarTitle.Units = titleunits;
187+
colorbarTitle.FontUnits = titlefontunits;
188+
colorbarYLabel.Units = ylabelunits;
189+
colorbarYLabel.FontUnits = ylabelfontunits;
193190

194191
if ~isHG2
195-
set(colorbarXLabel,'Units', xlabelunits);
196-
set(colorbarXLabel,'FontUnits', xlabelfontunits);
192+
colorbarXLabel.Units = xlabelunits;
193+
colorbarXLabel.FontUnits = xlabelfontunits;
197194
end
198195

199196
%---------------------------------------------------------------------%
@@ -207,10 +204,8 @@
207204
if isempty(tickValues)
208205
showTickLabels = false;
209206
colorbar.ticks = '';
210-
211207
elseif isempty(tickLabels)
212208
colorbar.tickvals = tickValues;
213-
214209
else
215210
colorbar.tickvals = tickValues;
216211
colorbar.ticktext = tickLabels;
@@ -232,9 +227,7 @@
232227
case 'out'
233228
colorbar.ticks = 'outside';
234229
end
235-
236230
end
237-
238231
else
239232
colorbar = setTicksNotHG2(colorbar, colorbarData);
240233
end
@@ -268,7 +261,7 @@
268261
%---------------------------------------------------------------------%
269262

270263
%-REVERT UNITS-%
271-
set(obj.State.Colorbar(colorbarIndex).Handle, 'Units', colorbarUnits);
264+
obj.State.Colorbar(colorbarIndex).Handle.Units = colorbarUnits;
272265
end
273266

274267
function colorbar = setTicksNotHG2(colorbar, colorbarData)
@@ -288,7 +281,7 @@
288281
colorbar.ticks = 'outside';
289282
end
290283

291-
if strcmp(colorbarData.YTickLabelMode,'auto')
284+
if strcmp(colorbarData.YTickLabelMode, 'auto')
292285
%-autotick-%
293286
colorbar.autotick = true;
294287
%-numticks-%
@@ -325,7 +318,7 @@
325318
colorbar.ticks = 'outside';
326319
end
327320

328-
if strcmp(colorbarData.XTickLabelMode,'auto')
321+
if strcmp(colorbarData.XTickLabelMode, 'auto')
329322
%-autotick-%
330323
colorbar.autotick = true;
331324
%-numticks-%

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
%-STANDARDIZE UNITS-%
3434
figunits = obj.State.Figure.Handle.Units;
35-
set(obj.State.Figure.Handle,'Units','pixels');
35+
obj.State.Figure.Handle.Units = 'pixels';
3636

3737
%-FIGURE DATA-%
3838
figure_data = obj.State.Figure.Handle;
@@ -73,5 +73,5 @@
7373
obj.layout.hovermode = 'closest';
7474

7575
%-REVERT UNITS-%
76-
set(obj.State.Figure.Handle,'Units',figunits);
76+
obj.State.Figure.Handle.Units = figunits;
7777
end

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
%-STANDARDIZE UNITS-%
1515
legendunits = obj.State.Legend(legIndex).Handle.Units;
1616
fontunits = obj.State.Legend(legIndex).Handle.FontUnits;
17-
set(obj.State.Legend(legIndex).Handle, 'Units', 'normalized');
18-
set(obj.State.Legend(legIndex).Handle, 'FontUnits', 'points');
17+
obj.State.Legend(legIndex).Handle.Units = 'normalized';
18+
obj.State.Legend(legIndex).Handle.FontUnits = 'points';
1919

2020
%-LEGEND DATA STRUCTURE-%
2121
legend_data = obj.State.Legend(legIndex).Handle;
@@ -51,6 +51,6 @@
5151
end
5252

5353
%-REVERT UNITS-%
54-
set(obj.State.Legend(legIndex).Handle,'Units',legendunits);
55-
set(obj.State.Legend(legIndex).Handle,'FontUnits',fontunits);
54+
obj.State.Legend(legIndex).Handle.Units = legendunits;
55+
obj.State.Legend(legIndex).Handle.FontUnits = fontunits;
5656
end

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
%-STANDARDIZE UNITS-%
4545
legendUnits = obj.State.Legend(legIndex).Handle.Units;
4646
fontUnits = obj.State.Legend(legIndex).Handle.FontUnits;
47-
set(obj.State.Legend(legIndex).Handle,'Units','normalized');
48-
set(obj.State.Legend(legIndex).Handle,'FontUnits','points');
47+
obj.State.Legend(legIndex).Handle.Units = 'normalized';
48+
obj.State.Legend(legIndex).Handle.FontUnits = 'points';
4949

5050
%---------------------------------------------------------------------%
5151

@@ -83,6 +83,6 @@
8383
end
8484

8585
%-REVERT UNITS-%
86-
set(obj.State.Legend(legIndex).Handle,'Units', legendUnits);
87-
set(obj.State.Legend(legIndex).Handle,'FontUnits', fontUnits);
86+
obj.State.Legend(legIndex).Handle.Units = legendUnits;
87+
obj.State.Legend(legIndex).Handle.FontUnits = fontUnits;
8888
end

0 commit comments

Comments
 (0)