App Designer: XY Zoom and XY Pan settings

6 visualizaciones (últimos 30 días)
mackhina
mackhina el 19 de En. de 2020
Comentada: Nishant Gupta el 23 de En. de 2020
Hi everyone,
Is there a way to lock/choose the XY settings for the zoom and pan features when viewing a 3D surf plot in App Designer?
scroll.png
Using the zoom in the App Designer is giving me big holes in the middle of my surf plots that I don't know how to stop? Any help would be greatly appreciated!
contour hole.png
Thanks in advance!
Cheers

Respuesta aceptada

mackhina
mackhina el 22 de En. de 2020
Editada: mackhina el 23 de En. de 2020
This solutions seems to work to maintain the Z-Axis for both the zoom and pan: UIAxes' YLim property cannot be listened to
I added the function to app designer:
function [inclusivezlim] = mapholdaltlims(app,ax)
objwithz = findobj(app.UIAxes.Children,'-property','ZData');
currmin_z = 0;
currmax_z = 0;
for i = 1:length(objwithz)
currmin_z = min([min(min(objwithz(i).ZData)), currmin_z]);%Need double mins because data could be 2d surface
currmax_z = max([max(max(objwithz(i).ZData)), currmax_z]);
end
inclusivezlim = [currmin_z currmax_z];
ax.ZLim = inclusivezlim;
end
And included the following in each of my plot functions:
warning('off','MATLAB:structOnObject');
warning('off','MATLAB:ui:javaframe:PropertyToBeRemoved'); % Added to turn off java warning
addlistener(struct(app.UIAxes).Axes, 'ZLim', 'PostSet', @(src,evnt)mapholdaltlims(app,app.UIAxes));
There is a delay after zooming/panning, when the Z-Axis is replotted, so it's not the fastest solution, but it does works!
Getting lots of warnings that I don't understand either? Does this mean this function will not work in future versions of Matlab?
Warning: The JavaFrame figure property will be removed in a future release. For more information, see
Recommendations for Java and ActiveX Users on mathworks.com.
> In func_name/startupFcn (line 76)
In appdesigner.internal.service/AppManagementService/tryCallback (line 336)
In matlab.apps/AppBase/runStartupFcn (line 41)
In func_name (line 565)
In appdesigner.internal.service/AppManagementService/runAppWithTryCatch (line 161)
In appdesigner.internal.service/AppManagementService/runDesktopApp (line 89)
In appdesigner.internal.model/AppModel/runAppHelper (line 649)
In appdesigner.internal.model.AppModel>@()appdesigner.internal.model.AppModel.runAppHelper(obj,appArguments) (line 509)
  1 comentario
Nishant Gupta
Nishant Gupta el 23 de En. de 2020
Hi,
Since the callback is involved So, it might take the time to load the data and process it according to the callback function. This might be the reason its slow. The Last warnings are because of the warning function that is created as it access JavaFrame and it may not be there in future release.

Iniciar sesión para comentar.

Más respuestas (2)

Nishant Gupta
Nishant Gupta el 22 de En. de 2020
Hi,
Most probably its because clipping of the plot is taking place when you are zooming in, just set 'clipping' property of UIaxes to 'off'.
app.UIAxes.Clipping = 'off';

mackhina
mackhina el 22 de En. de 2020
That stops the clipping in the Z axis, but I get axes now show through the plot when I zoom in, so the data isn't really useable from an end user perspective :(

Categorías

Más información sobre Data Exploration en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by