Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plot-lib/plot/private/common/parameters.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
(defparam plot-y-far-axis? Boolean #t)
(defparam plot-z-far-axis? Boolean #t)

(defparam collapse-ticks? Boolean #t)

(defparam2 plot-x-tick-label-angle angle Real Real 0 (rational 'plot-x-tick-label-angle))
(defparam2 plot-y-tick-label-angle angle Real Real 0 (rational 'plot-y-tick-label-angle))
(defparam2 plot-x-far-tick-label-angle angle Real Real 0 (rational 'plot-x-far-tick-label-angle))
Expand Down
28 changes: 16 additions & 12 deletions plot-lib/plot/private/plot2d/plot-area.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -262,21 +262,25 @@
(: x-far-ticks (Listof tick))
(: y-far-ticks (Listof tick))
(define x-ticks
(collapse-ticks (filter (λ ([t : tick]) (<= x-min (pre-tick-value t) x-max))
(map tick-inexact->exact rx-ticks))
(x-tick-near? y-min)))
(let ([exact-ticks-within-bounds (filter (λ ([t : tick]) (<= x-min (pre-tick-value t) x-max))
(map tick-inexact->exact rx-ticks))])
(if (collapse-ticks?) (collapse-ticks exact-ticks-within-bounds (x-tick-near? y-min))
exact-ticks-within-bounds)))
(define x-far-ticks
(collapse-ticks (filter (λ ([t : tick]) (<= x-min (pre-tick-value t) x-max))
(map tick-inexact->exact rx-far-ticks))
(x-tick-near? y-max)))
(let ([exact-ticks-within-bounds (filter (λ ([t : tick]) (<= x-min (pre-tick-value t) x-max))
(map tick-inexact->exact rx-far-ticks))])
(if (collapse-ticks?) (collapse-ticks exact-ticks-within-bounds (x-tick-near? y-max))
exact-ticks-within-bounds)))
(define y-ticks
(collapse-ticks (filter (λ ([t : tick]) (<= y-min (pre-tick-value t) y-max))
(map tick-inexact->exact ry-ticks))
(y-tick-near? x-min)))
(let ([exact-ticks-within-bounds (filter (λ ([t : tick]) (<= y-min (pre-tick-value t) y-max))
(map tick-inexact->exact ry-ticks))])
(if (collapse-ticks?) (collapse-ticks exact-ticks-within-bounds (y-tick-near? x-min))
exact-ticks-within-bounds)))
(define y-far-ticks
(collapse-ticks (filter (λ ([t : tick]) (<= y-min (pre-tick-value t) y-max))
(map tick-inexact->exact ry-far-ticks))
(y-tick-near? x-max)))
(let ([exact-ticks-within-bounds (filter (λ ([t : tick]) (<= y-min (pre-tick-value t) y-max))
(map tick-inexact->exact ry-far-ticks))])
(if (collapse-ticks?) (collapse-ticks exact-ticks-within-bounds (y-tick-near? x-max))
exact-ticks-within-bounds)))

;; ===============================================================================================
;; Tick and label parameters, and fixpoint margin computation
Expand Down
42 changes: 24 additions & 18 deletions plot-lib/plot/private/plot3d/plot-area.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -470,33 +470,39 @@
(: y-ticks (Listof tick))
(: z-ticks (Listof tick))
(define x-ticks
(collapse-ticks (filter (λ ([t : tick]) (<= x-min (pre-tick-value t) x-max))
(map tick-inexact->exact rx-ticks))
(x-ticks-near? x-axis-y)))
(let ([exact-ticks-within-bounds (filter (λ ([t : tick]) (<= x-min (pre-tick-value t) x-max))
(map tick-inexact->exact rx-ticks))])
(if (collapse-ticks?) (collapse-ticks exact-ticks-within-bounds (x-ticks-near? x-axis-y))
exact-ticks-within-bounds)))
(define y-ticks
(collapse-ticks (filter (λ ([t : tick]) (<= y-min (pre-tick-value t) y-max))
(map tick-inexact->exact ry-ticks))
(y-ticks-near? y-axis-x)))
(let ([exact-ticks-within-bounds (filter (λ ([t : tick]) (<= y-min (pre-tick-value t) y-max))
(map tick-inexact->exact ry-ticks))])
(if (collapse-ticks?) (collapse-ticks exact-ticks-within-bounds (y-ticks-near? y-axis-x))
exact-ticks-within-bounds)))
(define z-ticks
(collapse-ticks (filter (λ ([t : tick]) (<= z-min (pre-tick-value t) z-max))
(map tick-inexact->exact rz-ticks))
(z-ticks-near? z-axis-x z-axis-y)))
(let ([exact-ticks-within-bounds (filter (λ ([t : tick]) (<= z-min (pre-tick-value t) z-max))
(map tick-inexact->exact rz-ticks))])
(if (collapse-ticks?) (collapse-ticks exact-ticks-within-bounds (z-ticks-near? z-axis-x z-axis-y))
exact-ticks-within-bounds)))

(: x-far-ticks (Listof tick))
(: y-far-ticks (Listof tick))
(: z-far-ticks (Listof tick))
(define x-far-ticks
(collapse-ticks (filter (λ ([t : tick]) (<= x-min (pre-tick-value t) x-max))
(map tick-inexact->exact rx-far-ticks))
(x-ticks-near? x-far-axis-y)))
(let ([exact-ticks-within-bounds (filter (λ ([t : tick]) (<= x-min (pre-tick-value t) x-max))
(map tick-inexact->exact rx-far-ticks))])
(if (collapse-ticks?) (collapse-ticks exact-ticks-within-bounds (x-ticks-near? x-far-axis-y))
exact-ticks-within-bounds)))
(define y-far-ticks
(collapse-ticks (filter (λ ([t : tick]) (<= y-min (pre-tick-value t) y-max))
(map tick-inexact->exact ry-far-ticks))
(y-ticks-near? y-far-axis-x)))
(let ([exact-ticks-within-bounds (filter (λ ([t : tick]) (<= y-min (pre-tick-value t) y-max))
(map tick-inexact->exact ry-far-ticks))])
(if (collapse-ticks?) (collapse-ticks exact-ticks-within-bounds (y-ticks-near? y-far-axis-x))
exact-ticks-within-bounds)))
(define z-far-ticks
(collapse-ticks (filter (λ ([t : tick]) (<= z-min (pre-tick-value t) z-max))
(map tick-inexact->exact rz-far-ticks))
(z-ticks-near? z-far-axis-x z-far-axis-y)))
(let ([exact-ticks-within-bounds (filter (λ ([t : tick]) (<= z-min (pre-tick-value t) z-max))
(map tick-inexact->exact rz-far-ticks))])
(if (collapse-ticks?) (collapse-ticks exact-ticks-within-bounds (z-ticks-near? z-far-axis-x z-far-axis-y))
exact-ticks-within-bounds)))

;; ===============================================================================================
;; Tick and label parameters, and fixpoint margin computation
Expand Down
1 change: 1 addition & 0 deletions plot-lib/plot/private/utils-and-no-gui.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
plot-x-far-axis?
plot-y-far-axis?
plot-z-far-axis?
collapse-ticks?
plot-x-tick-label-anchor
plot-y-tick-label-anchor
plot-x-far-tick-label-anchor
Expand Down