Skip to content

Commit 1b7e767

Browse files
committed
misc
1 parent 1ac928b commit 1b7e767

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/data_visualization/violin.clj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@
5353
;;; - [Violin Plots: A Box Plot-Density Trace Synergism](https://web.archive.org/web/20231106021405/https://quantixed.org/wp-content/uploads/2014/12/hintze_1998.pdf) Jerry L. Hintze, Ray D. Nelson
5454
;;; - [Violin Plot - Wikipedia](https://en.wikipedia.org/wiki/Violin_plot)
5555

56+
;;; ## Resources
57+
;;; - [A miminal Clojure project for generating Vega plots](https://github.com/mtravers/vega-minimal)
58+
;;; - [Vaguely](https://vagueness.herokuapp.com/index.html?library=99ff4864-1870-4fbd-9119-1a6f7675ed2d) Vaguely, a block-based environment for experimenting with Vega
59+
;;; - [Vega-Lite](https://vega.github.io/vega-lite/) The Vega documentation
60+
;;; - [Hanami](ttps://github.com/jsa-aerial/hanami)), a templating library for generating Vega plots in Clojure
61+
62+
5663
;;; # Data
5764

5865
;;; We'll use this classic [dataset about penguin morphology](https://github.com/ttimbers/palmerpenguins/blob/master/README.md). Each row in this dataset describes an individual penguin, with properties like species, sex, body mass, wing size.

src/data_visualization/violin2.clj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,14 @@
227227

228228
;;; # Rotate
229229

230-
;;; Violin plots are often oriented vertically. We'll rotate our visualizations with another hack.
230+
;;; Violin plots are often oriented vertically. We'll rotate our visualizations with another hack. First we'll define a utility function to swap pairs of keywords in a stucture, using some existing utility functions in multitool:
231231

232232
(defn swap-keys
233-
"Swap keywords"
233+
"Swap keywords in struct based on pairs defined in keyswaps"
234234
[struct keyswaps]
235-
(let [remap (mu/map-bidirectional keyswaps)]
236-
(mu/walk-filtered
237-
(fn [k]
238-
(get remap k k))
235+
(let [remap (mu/map-bidirectional keyswaps)] ;This ensures that the relationships in keyswaps are bidirectional
236+
(mu/walk-filtered ;This applies a fn to all keyword elements of struct.
237+
(fn [k] (get remap k k))
239238
struct
240239
keyword?)))
241240

0 commit comments

Comments
 (0)