axes Interactions 'restore view' not working properly
12 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
0 Commenti
Risposte (2)
Marten Amschler
il 21 Apr 2021
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 Commento
Gordon Edwards
il 26 Apr 2021
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
il 6 Apr 2023
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.
0 Commenti
Vedere anche
Categorie
Scopri di più su Axis Labels in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!