# drawnow

## Purpose

Complete any pending drawing.

## Synopsis

    drawnow

## Description

`drawnow` flushes the event queue and forces MATLAB to update the screen.

While running an M-file, MATLAB does not render the screen with each graphics statement. For example, executing the M-file

    plot(x,y)
    axis([0  10  0  10])
    title('A short title')
    grid

does not draw the screen until after the final statement when MATLAB returns to its prompt. This allows for efficient execution of sequences of graphics statements. In the example above, the axis is drawn once; if typed at the command line, it would be drawn twice.

Four events cause MATLAB to flush the event queue and draw the screen:

- a return to the MATLAB prompt
- a `pause` statement
- execution of a `getframe` command
- execution of a `drawnow` command

  (c) Copyright 1994 by The MathWorks, Inc.