Skip to content
Closed
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
21 changes: 19 additions & 2 deletions +labkit/+app/+plot/private/finitePlotLimits.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
end

function [xLim, yLim] = equalDataUnitLimits(ax, xLim, yLim)
drawnow
position = getpixelposition(ax, true);
position = resolveAxesPixelPosition(ax);
if numel(position) ~= 4 || position(3) <= 0 || position(4) <= 0
return;
end
Expand All @@ -35,6 +34,24 @@
yLim = unscaleLimits(yWork, yLog);
end

function position = resolveAxesPixelPosition(ax)
position = [NaN NaN NaN NaN];
for attempt = 1:3
drawnow
position = getpixelposition(ax, true);
if numel(position) == 4 && position(3) > 0 && position(4) > 0
return;
end
if attempt == 3
break;
end
end
fallback = ax.Position;
if numel(fallback) == 4 && fallback(3) > 0 && fallback(4) > 0
position = double(fallback);
end
end

function limits = scaleLimits(limits, isLog)
if isLog
if any(limits <= 0)
Expand Down
Loading