Skip to content

Commit 60015b4

Browse files
committed
aog wip
1 parent 2c1333a commit 60015b4

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/data_visualization/aog_in_clojure_part1.clj

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
(:require
151151
;; Tablecloth - Dataset manipulation
152152
[tablecloth.api :as tc]
153-
[tablecloth.column.api :as col]
153+
[tablecloth.column.api :as tcc]
154154

155155
;; Kindly - Notebook visualization protocol
156156
[scicloj.kindly.v4.kind :as kind]
@@ -394,7 +394,7 @@
394394
;; - Why: transforms need domains first; rendering libs handle layout better
395395
;;
396396
;; **4. Type-aware grouping**
397-
;; - Tablecloth gives us column types via `col/typeof` for free
397+
;; - Tablecloth gives us column types via `tcc/typeof` for free
398398
;; - Categorical aesthetics (`:=color :species`) create groups for transforms
399399
;; - Continuous aesthetics are visual-only (no grouping)
400400
;; - Explicit `:=group` aesthetic for manual control
@@ -533,7 +533,7 @@
533533
;; computing derived data. So we compute:
534534
;; - Statistical transforms (histogram bins, regression lines)
535535
;; - Domains when needed (always for `:geom`, only custom for `:vl`/`:plotly`)
536-
;; - Type information (from Tablecloth's `col/typeof`)
536+
;; - Type information (from Tablecloth's `tcc/typeof`)
537537
;;
538538
;; We delegate to rendering targets:
539539
;; - Axis rendering, tick placement, "nice numbers"
@@ -1831,12 +1831,12 @@
18311831
row-facet (:=row layer)
18321832

18331833
;; Helper to check if a column is categorical
1834-
;; Uses Tablecloth's col/typeof when available, falls back to value inspection
1834+
;; Uses Tablecloth's tcc/typeof when available, falls back to value inspection
18351835
categorical? (fn [col-key]
18361836
(when (and col-key dataset)
18371837
(let [col-type (try
18381838
;; Primary: Get type from Tablecloth metadata
1839-
(col/typeof (get dataset col-key))
1839+
(tcc/typeof (get dataset col-key))
18401840
(catch Exception _
18411841
;; Fallback: Infer from values for plain Clojure data
18421842
(infer-from-values (get dataset col-key))))]
@@ -2353,9 +2353,9 @@ iris
23532353
;; Tablecloth provides precise type information for each column, which we use
23542354
;; for type-aware grouping and aesthetic mapping.
23552355

2356-
{:bill-length-type (col/typeof (penguins :bill-length-mm))
2357-
:species-type (col/typeof (penguins :species))
2358-
:island-type (col/typeof (penguins :island))}
2356+
{:bill-length-type (tcc/typeof (penguins :bill-length-mm))
2357+
:species-type (tcc/typeof (penguins :species))
2358+
:island-type (tcc/typeof (penguins :island))}
23592359

23602360
;; Notice: We get precise type information (`:float64`, `:string`) without
23612361
;; examining values. This eliminates the need for complex type inference.
@@ -2919,7 +2919,7 @@ iris
29192919

29202920
;; **What happens here**:
29212921

2922-
;; 1. Dataset is grouped by `:species` (categorical column detected via Tablecloth's `col/typeof`)
2922+
;; 1. Dataset is grouped by `:species` (categorical column detected via Tablecloth's `tcc/typeof`)
29232923
;; 2. Three separate OLS regressions computed (one per species)
29242924
;; 3. Three regression lines rendered with matching colors
29252925
;; 4. Demonstrates type-aware grouping for statistical transforms
@@ -4641,15 +4641,15 @@ iris
46414641
;; ```clojure
46424642
;; (try
46434643
;; ;; Primary: Get type from Tablecloth metadata
4644-
;; (col/typeof (get dataset col-key))
4644+
;; (tcc/typeof (get dataset col-key))
46454645
;; (catch Exception _
46464646
;; ;; Fallback: Simple inference for plain Clojure data
46474647
;; (infer-from-values (get dataset col-key))))
46484648
;; ```
46494649

46504650
;; **How it works:**
46514651

4652-
;; 1. **Tablecloth datasets (primary path)** - Use `col/typeof` to get precise type information
4652+
;; 1. **Tablecloth datasets (primary path)** - Use `tcc/typeof` to get precise type information
46534653
;; - Returns types like `:float64`, `:string`, `:int32`, etc.
46544654
;; - Free, accurate, no guessing required
46554655
;; - This is why we convert plain data to datasets via `ensure-dataset`

0 commit comments

Comments
 (0)