Skip to content

Commit cbed77e

Browse files
committed
refactored the existing splom_tutorial post, so its main example can be consumed from other notebooks
1 parent 0f7d3d9 commit cbed77e

1 file changed

Lines changed: 23 additions & 20 deletions

File tree

src/data_visualization/splom_tutorial.clj

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -947,26 +947,29 @@ domains
947947
(select-keys all-regressions [[:sepal-length :sepal-width]
948948
[:petal-length :petal-width]])
949949
;; Render the complete 4×4 SPLOM
950-
(let [n 4
951-
grid-total-size (* n grid-panel-size)]
952-
(svg
953-
{:width grid-total-size
954-
:height grid-total-size}
955-
956-
;; Background panels
957-
(for [row (range n)
958-
col (range n)]
959-
(svg/rect [(* col grid-panel-size) (* row grid-panel-size)]
960-
grid-panel-size grid-panel-size
961-
{:fill (:grey-bg colors)}))
962-
963-
;; Render all 16 panels
964-
(for [row (range n)
965-
col (range n)]
966-
(let [x-col (all-cols col)
967-
y-col (all-cols row)
968-
regressions (get all-regressions [x-col y-col])]
969-
(render-panel x-col y-col row col regressions)))))
950+
(def iris-splom-4x4
951+
(let [n 4
952+
grid-total-size (* n grid-panel-size)]
953+
(svg
954+
{:width grid-total-size
955+
:height grid-total-size}
956+
957+
;; Background panels
958+
(for [row (range n)
959+
col (range n)]
960+
(svg/rect [(* col grid-panel-size) (* row grid-panel-size)]
961+
grid-panel-size grid-panel-size
962+
{:fill (:grey-bg colors)}))
963+
964+
;; Render all 16 panels
965+
(for [row (range n)
966+
col (range n)]
967+
(let [x-col (all-cols col)
968+
y-col (all-cols row)
969+
regressions (get all-regressions [x-col y-col])]
970+
(render-panel x-col y-col row col regressions))))))
971+
972+
iris-splom-4x4
970973

971974
;; A complete scatter plot matrix!
972975
;; - 4 diagonal histograms show distributions

0 commit comments

Comments
 (0)