Skip to content

Commit 56a05e7

Browse files
Use yaxIndex to find ysource for Area plots
1 parent 19c7756 commit 56a05e7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

plotly/plotlyfig_aux/handlegraphics/updateArea.m

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,17 @@ function updateArea(obj,areaIndex)
6666
%-AXIS INDEX-%
6767
axIndex = obj.getAxisIndex(obj.State.Plot(areaIndex).AssociatedAxis);
6868

69-
%-CHECK FOR MULTIPLE AXES-%
70-
[xsource, ysource] = findSourceAxis(obj,axIndex);
69+
%-check for multiple axes-%
70+
try
71+
for yax = 1:2
72+
yAxisColor = area_data.Parent.YAxis(yax).Color;
73+
yaxIndex(yax) = sum(yAxisColor == area_data.FaceColor);
74+
end
75+
[~, yaxIndex] = max(yaxIndex);
76+
[xsource, ysource] = findSourceAxis(obj, axIndex, yaxIndex);
77+
catch
78+
[xsource, ysource] = findSourceAxis(obj,axIndex);
79+
end
7180

7281
%---------------------------------------------------------------------%
7382

0 commit comments

Comments
 (0)