Skip to content

Commit b108127

Browse files
committed
Add options for few labels for histograms.
1 parent 32db42e commit b108127

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

metapict/histogram.rkt

+12-4
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@
196196
#:y-scale [y-scale 1.0]
197197
#:y-axis? [y-axis? #f] ; show second axis?
198198
#:y-grid? [y-grid? #f] ; show horizontal grid lines?
199-
)
199+
#:few-labels? [few-labels? #f]
200+
#:labels-at [labels-at #t])
200201
;; Range of observations
201202
(define min-obs (apply min observations))
202203
(define max-obs (apply max observations))
@@ -293,9 +294,16 @@
293294
(for/draw ([x bounds])
294295
(tick a1 x #:size 3))
295296

296-
; Labels of bounds
297-
(for/draw ([x bounds])
298-
(tick-label a1 x #t))
297+
; Labels
298+
(and labels-at
299+
(for/draw ([x labels-at])
300+
(tick-label a1 x #t)))
301+
(and few-labels?
302+
(draw (tick-label a1 (first bounds) #t)
303+
(tick-label a1 (last bounds) #t)))
304+
(and (not (or labels-at few-labels?))
305+
(for/draw ([x bounds])
306+
(tick-label a1 x #t)))
299307

300308
; Area block
301309
(histogram-block s bounds block-area max-weight block-label)

0 commit comments

Comments
 (0)