-
-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
Description
It's hard to align plots with different-sized axis labels. See below -- these are equal-sized figures vl-append-ed together (code is far below)
Suggestions
- Add parameters to set plot area, rather than overall plot+axis labels area
- Add option to pad labels to a fixed width
Code
#lang racket
(require plot/pict pict racket/class)
(define (make-ticks #:multiplier [mul 1])
(ticks (lambda (lo hi)
(for/list ([i (in-range lo hi)])
(pre-tick i #t)))
(lambda (lo hi pre)
(for/list ([pt (in-list pre)]
[i (in-naturals)])
(number->string (* mul i))))))
(define (make-plot m)
(parameterize ([plot-y-ticks (make-ticks #:multiplier m)])
(plot-pict (function (lambda (x) x))
#:x-min 0
#:x-max 5
#:y-min 0
#:y-max 5
#:width 90
#:height 90)))
(define plt (vl-append 0 (make-plot 1) (make-plot 10000)))
(send (pict->bitmap plt) save-file "maligned.png" 'png)
