### 3.3 Managing a display list ¶

Most graphics are overlays produced by several calls to the primitive plotting functions. For example, to compare of three calculations of, say, temperature as a function of time, type this:

    plg, temp1, time1
    plg, temp2, time2
    plg, temp3, time3

All three curves will appear on a single plot; as you type each plg command, you see that curve appear.

The basic paradigm of Yorick’s interactive graphics package is that as you type the command to add each curve to the plot, you see that curve appear. You may need to open a file or perform a calculation in order to generate the next curve. Often, an interesting comparison will occur to you only after you have seen the first few curves.

Even if you are not changing the data in a plot, you often will want to change plot limits, or see how your data looks with log or semi-log axes. You can call limits, logxy, or gridxy any time you want; the changes you request take place immediately.

Yorick maintains a display list – a list of the primitive plotting commands you have issued to display your data – to enable you to make these kinds of changes to your picture. The primitive functions just add items to the display list; you don’t need access to the actual rendering routines. You can change secondary features like plot limits or log axis scaling changing the plotted data. In order to actually produce a picture, Yorick must “walk” its display list, sending appropriate plotting commands to some sort of graphics output device.

If the picture changes, Yorick automatically walks its display list just before pausing to wait for your next input line. Thus, while you are thinking about what to do next, you are always looking at the current state of the display list.

A command like limits does not actually force an immediate replot; it just raises a flag that tells Yorick it needs to walk its display list. Therefore, feel free to call limits or logxy several times if a Yorick program is clearer that way – the effects will be cumulative, but you will not have to wait for Yorick to redraw your screen each time – the replot only happens when Yorick pauses to walk the display list.

Usually, the display list paradigm does just what you expect. However, the indirection can produce some subtle and surprising effects, especially when you write a Yorick program that produces graphical output (rather than just typing plotting commands directly).