Skip to content

Commit

Permalink
noj-book.visualizing-correlation-matrices - WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
daslu committed Apr 17, 2024
1 parent 09c2f72 commit a013d40
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions notebooks/noj_book/visualizing_correlation_matrices.clj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
:coli coli
:colj colj
:corr corr
:corr-str (format "%.02f" corr)})))))))
:corr-round (round corr 2 :HALF_EVEN)})))))))
(apply concat)
tc/dataset)))

Expand Down Expand Up @@ -109,4 +109,29 @@
:min 0
:max 1}))

;; Note that this plot supports tooltips.
;; Note the slider control and the tooltips.

;; Here is an example with an actual correlation matrix.

(let [columns-for-correlations [:sepal-length :sepal-width
:petal-length :petal-width]
correlations (-> noj-book.datasets/iris
(correlations-dataset columns-for-correlations)
(tc/select-columns [:coli :colj :corr-round])
tc/rows)]
(echarts-heatmap {:xyz-data correlations
:xs columns-for-correlations
:ys columns-for-correlations
:min -1
:max 1
:series-name "correlation"}))

;; TODO: Improve the layout so that the slider control does not overlap the labels.

;; ## Drawing a heatmap using Vega

;; coming soon

;; ## Drawing a heatmap using cljplot

;; coming soon

0 comments on commit a013d40

Please sign in to comment.