Skip to content

Commit 7196f7f

Browse files
Merge pull request #483 from plotly/remove-primary-try-catchs
Remove primary try-catchs that just hide errors (and fix resulting bugs)
2 parents 5381e35 + 064ae5e commit 7196f7f

File tree

12 files changed

+28
-45
lines changed

12 files changed

+28
-45
lines changed

plotly/plotlyfig.m

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -789,17 +789,16 @@ function validate(obj)
789789

790790
% update axes
791791
for n = 1:obj.State.Figure.NumAxes
792-
try
793-
if ~obj.PlotlyDefaults.isMultipleYAxes(n)
794-
updateAxis(obj,n);
792+
if ismember(ax(n).Type,specialAxisPlots())
793+
continue
794+
end
795+
if ~obj.PlotlyDefaults.isMultipleYAxes(n)
796+
updateAxis(obj,n);
795797

796-
else
797-
for yax = 1:2
798-
updateAxisMultipleYAxes(obj,n,yax);
799-
end
798+
else
799+
for yax = 1:2
800+
updateAxisMultipleYAxes(obj,n,yax);
800801
end
801-
catch
802-
% TODO
803802
end
804803
end
805804

plotly/plotlyfig_aux/core/updateAxis.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
%-------------------------------------------------------------------------%
5959

6060
%-check if headmap axis-%
61-
is_headmap_axis = isfield(axisData, 'XDisplayData');
62-
obj.PlotOptions.is_headmap_axis = is_headmap_axis;
61+
isHeatmapAxis = axisData.Type == "heatmap";
62+
obj.PlotOptions.is_headmap_axis = isHeatmapAxis;
6363

6464
%-------------------------------------------------------------------------%
6565

@@ -70,7 +70,7 @@
7070
%-------------------------------------------------------------------------%
7171

7272
%-xaxis-%
73-
if is_headmap_axis
73+
if isHeatmapAxis
7474
xaxis = extractHeatmapAxisData(obj,axisData, 'X');
7575
xExponentFormat = 0;
7676
else
@@ -80,7 +80,7 @@
8080
%-------------------------------------------------------------------------%
8181

8282
%-yaxis-%
83-
if is_headmap_axis
83+
if isHeatmapAxis
8484
yaxis = extractHeatmapAxisData(obj,axisData, 'Y');
8585
yExponentFormat = 0;
8686
else

plotly/plotlyfig_aux/core/updateData.m

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
function obj = updateData(obj, dataIndex)
44

5-
try
6-
75
%-update plot based on TreatAs PlotOpts-%
86

97
if ismember('pie3', lower(obj.PlotOptions.TreatAs))
@@ -174,19 +172,15 @@
174172
if isBoxplot(obj, dataIndex)
175173
updateBoxplot(obj, dataIndex);
176174
end
175+
otherwise
176+
error('Non-supported plot: %s',lower(obj.State.Plot(dataIndex).Class));
177177
end
178178
end
179-
180-
catch exception
181-
if obj.UserData.Verbose
182-
fprintf([exception.message '\nWe had trouble parsing the ' obj.State.Plot(dataIndex).Class ' object.\n',...
183-
'This trace might not render properly.\n\n']);
184-
end
185-
end
186179

187180
%------------------------AXIS/DATA CLEAN UP-------------------------------%
188181

189-
try
182+
ax = obj.State.Plot(dataIndex).AssociatedAxis;
183+
if ~ismember(ax.Type,specialAxisPlots())
190184
%-AXIS INDEX-%
191185
axIndex = obj.getAxisIndex(obj.State.Plot(dataIndex).AssociatedAxis);
192186

@@ -206,7 +200,7 @@
206200

207201
% check for xaxis categories
208202
if strcmpi(xaxis.type, 'category') && ...
209-
~strcmp(obj.data{dataIndex}.type,'box')
203+
~any(strcmp(obj.data{dataIndex}.type,{'heatmap' 'box'}))
210204
obj.data{dataIndex}.x = obj.State.Plot(dataIndex).AssociatedAxis.XTickLabel;
211205
eval(['obj.layout.xaxis' num2str(xsource) '.autotick=true;']);
212206
end
@@ -218,13 +212,10 @@
218212

219213
% check for yaxis categories
220214
if strcmpi(yaxis.type, 'category') && ...
221-
~strcmp(obj.data{dataIndex}.type,'box')
215+
~any(strcmp(obj.data{dataIndex}.type,{'heatmap' 'box'}))
222216
obj.data{dataIndex}.y = obj.State.Plot(dataIndex).AssociatedAxis.YTickLabel;
223217
eval(['obj.layout.yaxis' num2str(xsource) '.autotick=true;']);
224218
end
225-
catch
226-
% TODO to the future
227-
% disp('catch at line 157 in updateData.m file')
228219
end
229220

230221
%-------------------------------------------------------------------------%

plotly/plotlyfig_aux/handlegraphics/updateArea.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ function updateArea(obj,areaIndex)
7777
%-CHECK FOR MULTIPLE AXES-%
7878
[xsource, ysource] = findSourceAxis(obj,axIndex);
7979

80-
%-AXIS DATA-%
81-
eval(['xaxis = obj.layout.xaxis' num2str(xsource) ';']);
82-
eval(['yaxis = obj.layout.yaxis' num2str(ysource) ';']);
83-
8480
%-------------------------------------------------------------------------%
8581

8682
%-area xaxis-%

plotly/plotlyfig_aux/handlegraphics/updateBar.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,3 @@
130130

131131
%-------------------------------------------------------------------------%
132132
end
133-
134-

plotly/plotlyfig_aux/handlegraphics/updateContourgroup.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
%-set trace-%
3030
obj.data{plotIndex}.type = 'contour';
31-
obj.data{plotIndex}.xaxis = sprintf('x%s', xSource);
32-
obj.data{plotIndex}.yaxis = sprintf('y%s', xSource);
31+
obj.data{plotIndex}.xaxis = sprintf('x%d', xSource);
32+
obj.data{plotIndex}.yaxis = sprintf('y%d', ySource);
3333
obj.data{plotIndex}.name = plotData.DisplayName;
3434
obj.data{plotIndex}.visible = strcmp(plotData.Visible,'on');
3535
obj.data{plotIndex}.xtype = 'array';

plotly/plotlyfig_aux/handlegraphics/updateHistogram.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@
5757
%-CHECK FOR MULTIPLE AXES-%
5858
[xsource, ysource] = findSourceAxis(obj,axIndex);
5959

60-
%-AXIS DATA-%
61-
eval(['xaxis = obj.layout.xaxis' num2str(xsource) ';']);
62-
eval(['yaxis = obj.layout.yaxis' num2str(ysource) ';']);
63-
6460
%-------------------------------------------------------------------------%
6561

6662
%-hist xaxis-%

plotly/plotlyfig_aux/handlegraphics/updateQuivergroup.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
%------------------------------------------------------------------------%
77

88
%-get children-%
9-
quiver_child = quiver_group .Children;
9+
quiver_child = quiver_group.Children;
1010

1111
%------------------------------------------------------------------------%
1212

plotly/plotlyfig_aux/handlegraphics/updateStairseries.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
%------------------------------------------------------------------------%
77

88
%-get children-%
9-
stair_child = stair_group .Children;
9+
stair_child = stair_group.Children;
1010

1111
%------------------------------------------------------------------------%
1212

plotly/plotlyfig_aux/handlegraphics/updateStemseries.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
stem_group = obj.State.Plot(dataIndex).Handle;
55

66
%-get children-%
7-
stem_child = stem_group .Children;
7+
stem_child = stem_group.Children;
88

99
%------------------------------------------------------------------------%
1010

0 commit comments

Comments
 (0)