pause function works well to call graph/plot in a loop.
Suppose, you want to show a sequence of images in a for loop. If processes in a loop is not heavy, imshow() only shows image after the loop has executed. The code spends enough time to show images. This can be done by pause() function that halts execution as
for n = 1:10
img = imread( [ ‘image’ num2str(n) ‘.bmp’ ] );
pause(0.5); % execution is halted for 0.5 seconds