Testing print-graph
We can test the print-graph function with a short list of numbers:
- Install the final versions of
Y-axis-column,graph-body-print, andprint-graph(in addition to the rest of the code.) - Copy the following expression:emacs-lisp
(print-graph '(3 2 5 6 7 5 3 4 6 4 3 2 1)) - Switch to the
*scratch*buffer and place the cursor where you want the axis labels to start. - Type M-: (
eval-expression). - Yank the test expression into the minibuffer with C-y (
yank). - Press RET to evaluate the expression.
Emacs will print a graph that looks like this:
10 -
*
** *
5 - **** *
**** ***
* *********
************
1 - *************
| | | |
1 5 10 15On the other hand, if you pass print-graph a vertical-step value of 2, by evaluating this expression:
emacs-lisp
(print-graph '(3 2 5 6 7 5 3 4 6 4 3 2 1) 2)The graph looks like this:
20 -
*
** *
10 - **** *
**** ***
* *********
************
2 - *************
| | | |
1 5 10 15(A question: is the ‘2’ on the bottom of the vertical axis a bug or a feature? If you think it is a bug, and should be a ‘1’ instead, (or even a ‘0’), you can modify the sources.)