1

In our previous code we've had a basic UI using standard figures. I'm in the process of updating the code to use the new app designer style UIFigures - I'm not actually using the app designer tool, but rather building it programmatically.

When using the standard figures and axes, it is possible to constrain zooming and panning of an axis to say just the horizontal (x) direction. This was done using

pan 'xon'; %or
zoom 'xon';

However this style doesn't work for UIAxes elements.

I've tried modifying it to:

pan(theUIAxesElement, 'xon'); %or
zoom(theUIAxesElement, 'xon');

That arrangement works for the standard 'on' and 'off' parameters, however for the 'xon' or 'yon' I simply get an error message:

Error using matlab.ui.control.UIAxes/zoom
Unknown action character vector.

Are there any alternative approaches to accomplish the same behaviour as before - i.e. limiting pan and zoom to just one axis direction?


Note - if you need a minimal example to try out, the easiest thing to do is to run appdesigner, drag on a UIAxes element, and then run it. You should get a NameOfApp.NameOfAxesElement handle.

Tom Carpenter
  • 539
  • 4
  • 18
  • Unfortunately, ["for UI axes, both rotate3d and pan only support the on and off arguments".](https://uk.mathworks.com/help/matlab/ref/uiaxes.html#d119e1343156) – Anthony Jul 16 '18 at 03:22
  • @Anthony missed that line, thanks. You'd think they might actually put that info with the zoom and pan description pages. – Tom Carpenter Jul 16 '18 at 06:38
  • the `pan` and `zoom` for the new app designer ui are different from the ones for the old gui figure. The new ones are contained in a P code file (`MATLAB\R2018a\toolbox\matlab\uicomponents\uicomponents\graphics\+matlab\+ui\+control\UIAxes.p`) which is an encrypted binary file locked from being explored outside the develop team :(. – Anthony Jul 16 '18 at 06:41

0 Answers0