The problem is that this plotting function does not allow you to supply an existing axes handle as input so it relies on finding the current axes. By default, the handle visibiliity of UIFIgures is off so the axes within those figures are not discoverable.
From r2020a and later, you need to set the app's handle visibility to on so that the app's axes can be detected as "current". Then make the app's axes "current". Then, you can run the plotting function which will access your app's axes.
app.UIFigure.HandleVisibility = 'on';
set(0, 'CurrentFigure', app.UIFigure)
set(app.UIFigure,'CurrentAxes',app.UIAxes)
app.UIFigure.HandleVisibility = 'off';
Best Answer