The possible reason for axes to disappear is that the “preview” function is overriding the axis properties. In this case you can try to update the axis properties after calling “preview”.
You can do something like this after calling “preview”:
% To bring back the axes by setting the properties after preview
drawnow; % Ensure the preview updates the UI
app.UIAxes.XTick = [];
app.UIAxes.YTick = [];
app.UIAxes.Visible = 'on'; % Make the axes visible again
Here, the “drawnow” command forces MATLAB to update the Figure Window which might be necessary for the changes to take effect.
I have attached an example “mlapp” for your reference.