Skip to content

Commit

Permalink
Add options for few labels for histograms.
Browse files Browse the repository at this point in the history
  • Loading branch information
soegaard committed Jun 20, 2024
1 parent 32db42e commit b108127
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions metapict/histogram.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@
#:y-scale [y-scale 1.0]
#:y-axis? [y-axis? #f] ; show second axis?
#:y-grid? [y-grid? #f] ; show horizontal grid lines?
)
#:few-labels? [few-labels? #f]
#:labels-at [labels-at #t])
;; Range of observations
(define min-obs (apply min observations))
(define max-obs (apply max observations))
Expand Down Expand Up @@ -293,9 +294,16 @@
(for/draw ([x bounds])
(tick a1 x #:size 3))

; Labels of bounds
(for/draw ([x bounds])
(tick-label a1 x #t))
; Labels
(and labels-at
(for/draw ([x labels-at])
(tick-label a1 x #t)))
(and few-labels?
(draw (tick-label a1 (first bounds) #t)
(tick-label a1 (last bounds) #t)))
(and (not (or labels-at few-labels?))
(for/draw ([x bounds])
(tick-label a1 x #t)))

; Area block
(histogram-block s bounds block-area max-weight block-label)
Expand Down

0 comments on commit b108127

Please sign in to comment.