Skip to content

Commit 19201ed

Browse files
committed
composable_plotting wip
1 parent 3c31f3e commit 19201ed

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

src/data_visualization/aog/composable_plotting.clj

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
(require '[data-visualization.splom-tutorial :as splom-tut])
9393

9494
;; :::{.column-screen-inset-right}
95-
(kind/hiccup splom-tut/iris-splom-4x4)
95+
splom-tut/iris-splom-4x4
9696
;; :::
9797

9898
;; The goal of this post is to build a composable API where
@@ -104,7 +104,7 @@
104104
;; (plot {:brush true}))
105105
;; ```
106106
;;
107-
;; Everything that the SPLOM Tutorial does manually — grid layout,
107+
;; Everything that the SPLOM Tutorial does — grid layout,
108108
;; scale sharing, color assignment, diagonal detection —
109109
;; should follow from the composed specification.
110110
;; ---
@@ -183,9 +183,11 @@
183183
;; ### 📖 Datasets
184184

185185
;;
186-
;; Two datasets appear throughout: **iris** (150 flowers, 4 measurements
187-
;; plus species) and **mpg** (234 cars, fuel economy and class).
188-
;; Both come from [R datasets](https://vincentarelbundock.github.io/Rdatasets/).
186+
;; Three datasets appear throughout: **iris** (150 flowers, 4 measurements
187+
;; plus species), **mpg** (234 cars, fuel economy and class),
188+
;; and **tips** (244 restaurant bills with tip amount, party size, day,
189+
;; and smoker status).
190+
;; All come from [R datasets](https://vincentarelbundock.github.io/Rdatasets/).
189191
(def iris (rdatasets/datasets-iris))
190192
(def iris-quantities [:sepal-length :sepal-width :petal-length :petal-width])
191193

@@ -195,6 +197,10 @@ iris
195197

196198
mpg
197199

200+
(def tips (rdatasets/reshape2-tips))
201+
202+
tips
203+
198204
;; ---
199205

200206
;; ## Composing Views
@@ -2309,15 +2315,10 @@ mpg
23092315
;;
23102316
;; `facet-grid` maps two columns to rows and columns of panels:
23112317

2312-
;; The [tips](https://rdrr.io/cran/reshape2/man/tips.html) dataset records
2313-
;; restaurant bills with tip amount, party size, day, and smoker status.
2314-
2315-
(let [tips (tc/dataset "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv"
2316-
{:key-fn keyword})]
2317-
(-> (view tips [[:total_bill :tip]])
2318-
(lay (point {:color :day}))
2319-
(facet-grid :smoker :sex)
2320-
(plot {:width 600 :height 500})))
2318+
(-> (view tips [[:total-bill :tip]])
2319+
(lay (point {:color :day}))
2320+
(facet-grid :smoker :sex)
2321+
(plot {:width 600 :height 500}))
23212322

23222323
;; ### 🧪 Faceted Scatter with Free Y-Scale
23232324
;;

0 commit comments

Comments
 (0)