前述の関数群により、縦軸のラベルとして挿入するための、番号付き文字列と空白文字列のリストを生成する関数を構築するために必要なツールがすべて揃います:
(defun Y-axis-column (height width-of-label) "Construct list of Y axis labels and blank strings. For HEIGHT of line above base and WIDTH-OF-LABEL." (let (Y-axis)
(while (> height 1)
(if (zerop (% height Y-axis-label-spacing))
;; Insert label.
(setq Y-axis
(cons
(Y-axis-element height width-of-label)
Y-axis))
;; Else, insert blanks. (setq Y-axis (cons (make-string width-of-label ? ) Y-axis))) (setq height (1- height))) ;; Insert base line. (setq Y-axis (cons (Y-axis-element 1 width-of-label) Y-axis)) (nreverse Y-axis)))
この関数では、まず height
の値から始め、その値から1を繰り返し減算します。減算を行うたびに、その値が Y-axis-label-spacing の整数倍であるかどうかを判定します。整数倍であれば Y-axis-element 関数を用いて番号付きラベルを作成し、そうでなければ make-string
関数を用いて空白ラベルを作成します。ベースラインは、数値の1に続いてティックマークで構成されます。