Skip to content

Commit d657eb9

Browse files
committed
tableplot param flow - wip
1 parent e8bcb5e commit d657eb9

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/data_visualization/tableplot_parameter_flow.clj

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@
6464
;;
6565
;; Let's start with a basic dataset and plot.
6666

67-
;; Assume we have some data.
68-
6967
(def sample-data
7068
(tc/dataset {:x [1 2 3 4 5]
7169
:y [2 4 3 5 7]}))
@@ -134,9 +132,9 @@
134132
;; better way to teach Tufte's [data-ink ratio](https://infovis-wiki.net/wiki/Data-Ink_Ratio) principle than doing exactly
135133
;; what it asks us to avoid, by adding some chartjunk?
136134

137-
;; Here are a few ways we can do it.
135+
;; Here are three approaches, each with different tradeoffs.
138136

139-
;; ## Using the relevant substitution keys
137+
;; ## Approach 1: Using the relevant substitution keys
140138

141139
;; Sometimes, what we need can be precisely specified in Tableplot.
142140
;; You may find the following in Tableplot's
@@ -146,7 +144,9 @@
146144
;; - [`:=yaxis-gridcolor`](https://scicloj.github.io/tableplot/tableplot_book.plotly_reference.html#yaxis-gridcolor) - The color for the y axis grid lines
147145

148146
;; To use them, you can add a `base` before your plot layers,
149-
;; and configure it with these keys:
147+
;; and configure it with these keys. We use `plotly/base` because its
148+
;; parameters flow to all subsequent layers, which is useful when
149+
;; composing multiple layers with shared settings.
150150

151151
(-> sample-data
152152
(plotly/base {:=xaxis-gridcolor "green"
@@ -170,11 +170,12 @@
170170

171171
;; :::
172172

173-
;; ## Overriding a broader-scope key
173+
;; ## Approach 2: Overriding a broader-scope key
174174

175-
;; Sometimes, you will not find exactly what you need in Tableplot's
176-
;; parameter system. Plotly.js itself will always be richer and more
177-
;; flexible.
175+
;; What if the specific keys you need don't exist in Tableplot yet?
176+
;;
177+
;; Plotly.js itself will always be richer and more flexible than Tableplot's
178+
;; parameter system.
178179

179180
;; Imagine that the above `:=xaxis-gridcolor` & `:=yaxis-gridcolor` would
180181
;; not be supported.
@@ -183,7 +184,7 @@
183184
;; [Styling and Coloring Axes and the Zero-Line](https://plotly.com/javascript/axes/#styling-and-coloring-axes-and-the-zero-line)
184185
;; in the Plotly.js docs, you will
185186
;; see that, under the `layout` part of the specification,
186-
;; you can specificy `gridcolor` for each of the axes.
187+
;; you can specify `gridcolor` for each of the axes.
187188

188189
;; In Tableplot, we can specify the whole layout using `:=layout`, and thus
189190
;; have anything we need in there.
@@ -227,14 +228,14 @@
227228

228229
;; :::
229230

230-
;; ## Direct Manipulation After `plotly/plot`
231+
;; ## Approach 3: Direct Manipulation After `plotly/plot`
231232

232-
;; Sometimes, you wish to work with Plotly.js high-level notions,
233-
;; but in a more refined way, preserving most of what we have.
233+
;; The previous approaches work within Tableplot's API. But what if you need
234+
;; more surgical control — to use Plotly.js concepts while preserving most defaults?
234235

235-
;; Can we do it?
236+
;; Of course we can do that!
236237

237-
;; Of course, the answer has been was in front of us the whole time:
238+
;; Of course, the answer has been in front of us the whole time:
238239
;; [It's just data](https://www.youtube.com/watch?v=jlPaby7suOc&t=1000s).
239240

240241
;; We do not need to use Tableplot's API for everything.

0 commit comments

Comments
 (0)