axes Interactions 'restore view' not working properly

조회 수: 8 (최근 30일)
Gordon
Gordon 2021년 3월 20일
답변: Joshua 2023년 4월 6일
This problem seems to have been discussed in Answers in March 2019 but it's not clear to me that a satisfactory resolution was reached.
I have uifigure containing a single axes with the properties
.Position = [50 50 512 512];
.XLim = [0 512];
.YLim = [0 512];
The pan and zoom features on the interactions menu work properly on the plotted function. However, on activating the 'Restore View' button the axes limits are changed to
.XLim = [0 500];
.Ylim = [0 500];
This is really irritating and screws up the appearance of the plots. I would like to think that the number 500 is a clue, but I have no idea where it comes from.
Is there a workaround apart from removing the interactions bar?
Gordon

답변 (2개)

Marten Amschler
Marten Amschler 2021년 4월 21일
I have the same problem. After I activate the "Restore View" button. The XLim, YLim, ZLims will be set to some values that I don't understand where they are coming from. I have an Axes in my GUIDE, that will i update alot (so I plot something; use cla; and plot something else). How can I manually set the values that 'Restore View' would set?
thanks
  댓글 수: 1
Gordon Edwards
Gordon Edwards 2021년 4월 26일
Hello Marten
I seem to have made the problem go away, but unfortunately I don't understand why. I have included the code for my plotting function that seems to work - i.e. after using the 'Restore view' button, the x, y limits are identical to the original values. You will note that there no tick marks and this may possibly be relevant, although I'm guessing somewhat. Good luck and I would be glad to hear of any progress in understanding the cause of the problem.
Gordon
function PlotDrawing(app)
% Plot the function app.Plot(1:n,1:2) on the axes app.UIAxes01
% The axes is square, width = height = app.AxesSize
Z = app.Plot; % x,y coords
ax = app.UIAxes01;
cla(ax)
ax.Units = 'pixels';
ax.XTick = [];
ax.YTick = [];
ax.Position = [ax.Position(1:2), app.AxesSize, app.AxesSize];
ax.XLim = [0, app.AxesSize];
ax.YLim = [0, app.AxesSize];
ax.Box = 'on';
ax.Color = app.BackgroundColor;
plot(ax, Z(:,1), Z(:,2), 'Color', app.LineColor)
end

댓글을 달려면 로그인하십시오.


Joshua
Joshua 2023년 4월 6일
The limits that are used when "Restore View" is activated come from app.UIAxes.InteractionOptions.RestoredXLimits, RestoredYLimits, and RestoredZLimts in app designer. I am not sure in other figures, but there may be a similar property.
This link may provide a more indepth explanation.

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by