Skip to content

Commit 703538c

Browse files
committed
aog wip
1 parent 018b8df commit 703538c

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

src/data_visualization/aog_in_clojure_part1.clj

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,10 +2193,17 @@
21932193
:hist-rects hist-rects}))
21942194

21952195
(defn- get-scale-domain
2196-
"Extract custom domain for an aesthetic from layers, or return nil if not specified."
2197-
[layers-vec aesthetic]
2196+
"Extract custom domain for an aesthetic from plot spec, or return nil if not specified.
2197+
2198+
Args:
2199+
- spec: Plot specification map (not layers-vec)
2200+
- aesthetic: Keyword like :x, :y, :color
2201+
2202+
Returns:
2203+
- Domain vector [min max] or nil if not specified"
2204+
[spec aesthetic]
21982205
(let [scale-key (keyword (str "=scale-" (name aesthetic)))]
2199-
(some #(get-in % [scale-key :domain]) layers-vec)))
2206+
(get-in spec [scale-key :domain])))
22002207

22012208
;; Render plot using thi.ng/geom to static SVG.
22022209
;;
@@ -2237,8 +2244,8 @@
22372244
panel-height (/ height num-rows)
22382245

22392246
;; Check for custom scale domains
2240-
custom-x-domain (get-scale-domain layers-vec :x)
2241-
custom-y-domain (get-scale-domain layers-vec :y)
2247+
custom-x-domain (get-scale-domain spec :x)
2248+
custom-y-domain (get-scale-domain spec :y)
22422249

22432250
;; Compute transformed points for ALL facets (for shared domain)
22442251
all-transformed-points
@@ -3786,8 +3793,8 @@ iris
37863793
col-var (when is-faceted? (some :=col layers-vec))
37873794

37883795
;; Check for custom scale domains
3789-
custom-x-domain (get-scale-domain layers-vec :x)
3790-
custom-y-domain (get-scale-domain layers-vec :y)
3796+
custom-x-domain (get-scale-domain spec :x)
3797+
custom-y-domain (get-scale-domain spec :y)
37913798

37923799
;; Create context map for render-layer
37933800
context {:custom-x-domain custom-x-domain
@@ -3962,8 +3969,8 @@ iris
39623969
col-var (when is-faceted? (some :=col layers-vec))
39633970

39643971
;; Check for custom scale domains
3965-
custom-x-domain (get-scale-domain layers-vec :x)
3966-
custom-y-domain (get-scale-domain layers-vec :y)
3972+
custom-x-domain (get-scale-domain spec :x)
3973+
custom-y-domain (get-scale-domain spec :y)
39673974

39683975
;; Create context map for render-layer
39693976
context {:custom-x-domain custom-x-domain

0 commit comments

Comments
 (0)