Skip to content

Commit f9f9509

Browse files
committed
tableplot param flow wip
1 parent 5968889 commit f9f9509

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/data_visualization/tableplot_parameter_flow.clj

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
;; as we'll see in this tutorial.
5555
;;
5656
;; **Further reading:**
57+
5758
;; - [ggplot2: Elegant Graphics for Data Analysis](https://ggplot2-book.org/) - The definitive guide showing how to balance simplicity and flexibility
5859
;; - [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
5960
;; - [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
@@ -74,12 +75,16 @@ sample-data
7475
;; which generates interactive Plotly.js visualizations. Tableplot also supports other backends
7576
;; like Vega-Lite and an experimental transpilation API.
7677

77-
;; We can make a basic line plot. This is really easy, because the
78+
;; We can make a basic plot with two layers.
79+
;; This is really easy with our data, because the
7880
;; `:x` and `:y` columns are used by default for the plot's axes.
7981

8082
(-> sample-data
83+
(plotly/layer-point {:=mark-size 20})
8184
plotly/layer-line)
8285

86+
;; ### Goal
87+
8388
;; Assume that we now wish to colour the grid lines: vertical by green,
8489
;; horizontal by red. After all, what would be a
8590
;; better way to teach Tufte's [data-ink ratio](https://infovis-wiki.net/wiki/Data-Ink_Ratio) principle than doing exactly
@@ -99,6 +104,7 @@ sample-data
99104
;; Clojure data structures.
100105

101106
(-> sample-data
107+
(plotly/layer-point {:=mark-size 20})
102108
plotly/layer-line
103109
kind/pprint)
104110

@@ -125,6 +131,7 @@ sample-data
125131
;; Plotly.js specification? This is what `plotly/plot` is for.
126132

127133
(-> sample-data
134+
(plotly/layer-point {:=mark-size 20})
128135
plotly/layer-line
129136
plotly/plot
130137
kind/pprint)
@@ -144,6 +151,7 @@ sample-data
144151
(-> sample-data
145152
(plotly/base {:=xaxis-gridcolor "green"
146153
:=yaxis-gridcolor "red"})
154+
(plotly/layer-point {:=mark-size 20})
147155
plotly/layer-line)
148156

149157
;; ### A brief look inside
@@ -156,6 +164,7 @@ sample-data
156164
(-> sample-data
157165
(plotly/base {:=xaxis-gridcolor "green"
158166
:=yaxis-gridcolor "red"})
167+
(plotly/layer-point {:=mark-size 20})
159168
plotly/layer-line
160169
plotly/plot
161170
kind/pprint)
@@ -183,6 +192,7 @@ sample-data
183192
(-> sample-data
184193
(plotly/base {:=layout {:xaxis {:gridcolor "green"}
185194
:yaxis {:gridcolor "red"}}})
195+
(plotly/layer-point {:=mark-size 20})
186196
plotly/layer-line)
187197

188198
;; Notice that a few other details of the aesthetics have changed,
@@ -201,6 +211,7 @@ sample-data
201211
(-> sample-data
202212
(plotly/base {:=layout {:xaxis {:gridcolor "green"}
203213
:yaxis {:gridcolor "red"}}})
214+
(plotly/layer-point {:=mark-size 20})
204215
plotly/layer-line
205216
plotly/plot
206217
kind/pprint)
@@ -229,6 +240,7 @@ sample-data
229240
;; specification, as data.
230241

231242
(-> sample-data
243+
(plotly/layer-point {:=mark-size 20})
232244
plotly/layer-line
233245
plotly/plot
234246
(assoc-in [:layout :xaxis :gridcolor] "green")
@@ -241,6 +253,7 @@ sample-data
241253
;; You already know what to expect here:
242254

243255
(-> sample-data
256+
(plotly/layer-point {:=mark-size 20})
244257
plotly/layer-line
245258
plotly/plot
246259
(assoc-in [:layout :xaxis :gridcolor] "green")

0 commit comments

Comments
 (0)