Node:print-Y-axis, Next:, Previous:print-graph Varlist, Up:Full Graph



C.2 The print-Y-axis Function

The job of the print-Y-axis function is to print a label for the vertical axis that looks like this:

    10 -




     5 -



     1 -

The function should be passed the height of the graph, and then should construct and insert the appropriate numbers and marks.

It is easy enough to see in the figure what the Y axis label should look like; but to say in words, and then to write a function definition to do the job is another matter. It is not quite true to say that we want a number and a tic every five lines: there are only three lines between the 1 and the 5 (lines 2, 3, and 4), but four lines between the 5 and the 10 (lines 6, 7, 8, and 9). It is better to say that we want a number and a tic mark on the base line (number 1) and then that we want a number and a tic on the fifth line from the bottom and on every line that is a multiple of five.