|
29 | 29 | ;; |
30 | 30 | ;; This tutorial is a brief intro to this feature. |
31 | 31 |
|
| 32 | +;; ### Background: The Layered Grammar of Graphics |
| 33 | +;; |
| 34 | +;; 💡 *(can skip on first read)* |
| 35 | +;; |
| 36 | +;; Tableplot is inspired by the [**layered grammar of graphics**](https://vita.had.co.nz/papers/layered-grammar.html), |
| 37 | +;; a framework for understanding and building statistical visualizations. Originally developed by |
| 38 | +;; Leland Wilkinson and later refined by Hadley Wickham in ggplot2, the grammar views plots as |
| 39 | +;; compositions of independent components: data, aesthetic mappings, geometric objects, scales, |
| 40 | +;; coordinates, and facets. |
| 41 | +;; |
| 42 | +;; The challenge in implementing such a grammar is achieving multiple goals simultaneously: |
| 43 | +;; |
| 44 | +;; - **Succinct**: Simple things should be simple - sensible defaults for common cases |
| 45 | +;; - **Declarative**: Describe *what* you want, not *how* to draw it |
| 46 | +;; - **Flexible**: Support customization without sacrificing simplicity |
| 47 | +;; - **Observable**: Make the details visible and understandable when needed |
| 48 | +;; - **Extensible**: Allow users to work with internals without breaking abstractions |
| 49 | +;; |
| 50 | +;; Tableplot addresses these challenges by mostly adopting [Hanami](https://github.com/jsa-aerial/hanami)'s |
| 51 | +;; solution as a starting point. Hanami introduced a template-based approach with substitution keys, |
| 52 | +;; allowing hierarchical defaults: you can rely on conventions for quick plots, or override specific |
| 53 | +;; details when needed. The templates approach makes the transformation process observable, |
| 54 | +;; as we'll see in this tutorial. |
| 55 | +;; |
| 56 | +;; **Further reading:** |
| 57 | +;; - [ggplot2: Elegant Graphics for Data Analysis](https://ggplot2-book.org/) - The definitive guide showing how to balance simplicity and flexibility |
| 58 | +;; - [Demystifying stat_ layers in ggplot2](https://yjunechoe.github.io/posts/2020-09-26-demystifying-stat-layers-ggplot2/) - June Choe's exploration of how the grammar elegantly handles data transformations, with special focus on making the internals observable and extensible |
| 59 | +;; - [Analyzing Data with Clojure (Kevin Lynagh, 2012)](https://www.youtube.com/watch?v=xyGggdg31mc) - An early Clojure attempt to handle the challenge of building a grammar of graphics |
| 60 | + |
32 | 61 | ;; ## The Challenge: Customizing Grid Colors |
33 | 62 | ;; |
34 | 63 | ;; Let's start with a basic dataset and plot. |
@@ -60,7 +89,7 @@ sample-data |
60 | 89 |
|
61 | 90 | ;; ### A brief look inside |
62 | 91 | ;; |
63 | | -;; *(can skip on first read)* |
| 92 | +;; 💡 *(can skip on first read)* |
64 | 93 |
|
65 | 94 | ;; By default, when used in [Kindly](https://scicloj.github.io/kindly-noted/)-compatible |
66 | 95 | ;; tools like [Clay](https://scicloj.github.io/clay/) and in Clojure Civitas posts, |
@@ -119,7 +148,7 @@ sample-data |
119 | 148 |
|
120 | 149 | ;; ### A brief look inside |
121 | 150 | ;; |
122 | | -;; *(can skip on first read)* |
| 151 | +;; 💡 *(can skip on first read)* |
123 | 152 |
|
124 | 153 | ;; Let us see what actually has changed in the |
125 | 154 | ;; resulting specification: |
@@ -165,7 +194,7 @@ sample-data |
165 | 194 |
|
166 | 195 | ;; ### A brief look inside |
167 | 196 | ;; |
168 | | -;; *(can skip on first read)* |
| 197 | +;; 💡 *(can skip on first read)* |
169 | 198 |
|
170 | 199 | ;; Let us see what happens: |
171 | 200 |
|
@@ -207,7 +236,7 @@ sample-data |
207 | 236 |
|
208 | 237 | ;; ### A brief look inside |
209 | 238 | ;; |
210 | | -;; *(can skip on first read)* |
| 239 | +;; 💡 *(can skip on first read)* |
211 | 240 |
|
212 | 241 | ;; You already know what to expect here: |
213 | 242 |
|
|
0 commit comments