Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions plotly/plotlyfig_aux/helpers/isOverlappingAxis.m
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
function [overlapping, overlapaxes] = isOverlappingAxis(obj, axIndex)
%-STANDARDIZE UNITS-%
axis_units = cell(1,axIndex);
for a = 1:axIndex
axis_units{a} = obj.State.Axis(a).Handle.Units;
obj.State.Axis(a).Handle.Units = "normalized";
end

%-STANDARDIZE UNITS-%
axis_units = cell(1,axIndex);
for a = 1:axIndex
axis_units{a} = obj.State.Axis(a).Handle.Units;
set(obj.State.Axis(a).Handle,'Units','normalized');
end

% check axis overlap
overlapaxes = find(arrayfun(@(x)(isequal(x.Handle.Position,obj.State.Axis(axIndex).Handle.Position)),obj.State.Axis(1:axIndex)));
overlapping = length(overlapaxes) > 1; %greater than 1 because obj.State.Axis(axIndex) will always be an overlapping axis

%-REVERT UNITS-%
for a = 1:axIndex
set(obj.State.Axis(a).Handle,'Units',axis_units{a});
end
% check axis overlap
if axIndex == 1 % redundant to check this case
overlapaxes = 1;
else
overlapaxes = find(arrayfun(@(x) isequal(x.Handle.Position, ...
obj.State.Axis(axIndex).Handle.Position), ...
obj.State.Axis(1:axIndex)));
end
% greater than 1 because obj.State.Axis(axIndex) will always be an
% overlapping axis
overlapping = length(overlapaxes) > 1;

%-REVERT UNITS-%
for a = 1:axIndex
obj.State.Axis(a).Handle.Units = axis_units{a};
end
end