I found a workaround which is to use animated lines which do not directly reference the workspace so work even when passed through the application compiler.
timebase = -pi:0.01:(4*pi);
Display = figure('Name','Animated lines','NumberTitle','off');
h = animatedline(timebase,sin(timebase));
hold on
j = animatedline(timebase,sin(timebase));
ylim([-1 1]);
title('Title')
legend
hold off
for x=0:0.01:100
clearpoints(h)
clearpoints(j)
values2 = 0.5*sin(timebase+x);
values = sin(x)*values1;
addpoints(h,timebase,values)
addpoints(j,timebase,values2)
drawnow
end