Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:cosmetic changes Add slots to faceting classes (not used yet) and abstract the function layer-dataset.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 106fc43687f0c31f58d0791b4871bbe98360136d5888dfb152818bb996f18457
User & Date: jackdaniel 2023-05-17 06:58:38
Context
2023-05-17
15:43
Implement a preliminary version of faceting We can spread the data across multiple renders. Current issues: - theme has a problem with external formatting-items (clim bug?) - resizing and moving charts is broken (ditto) - the number of columns is not configurable at the moment - currently we do two full passes over all layers in a facet check-in: eed0b7585b user: jack tags: master, trunk
06:58
cosmetic changes check-in: 106fc43687 user: jackdaniel tags: master, trunk
2023-05-16
16:22
theme: add a dead code branch that simulates faceting check-in: 0b027ef486 user: jack tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Code/faceting.lisp.

︙︙
8
9
10
11
12
13
14
15







16
17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
    :accessor scales)
   (as-table
    :type boolean
    :initarg :as-table
    :accessor as-table))
  (:default-initargs :scales :fixed
                     :as-table t))








;;; A single plot (no faceting).
(define-class <faceting-null> () ())


;;; "Ribbon" (one variable)
(define-class <faceting-wrap> ()
  (var nrow ncol direction))

#+ (or)
(dohash ((key val) (group-by (var facet) dataset))
  (funcall cont val))

;;; "Grid" (two variables)
(define-class <faceting-grid> ()
  (var1 var2))

#+ (or)
(dohash ((key dataset-1) (group-by (var1 facet) dataset))
  (dohash ((key dataset-2) (group-by (var2 facet)) dataset-1)
    (funcall cont val)))








>
>
>
>
>
>
>

|
>


|







|






8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    :accessor scales)
   (as-table
    :type boolean
    :initarg :as-table
    :accessor as-table))
  (:default-initargs :scales :fixed
                     :as-table t))

(define-class <facet> ()
  (dataset layers scales coords))

;;;
(define-class <faceting> ()
  (facets))

;;; A single plot (no faceting).
(define-class <faceting-null> (<faceting>)
  ())

;;; "Ribbon" (one variable)
(define-class <faceting-wrap> (<faceting>)
  (var nrow ncol direction))

#+ (or)
(dohash ((key val) (group-by (var facet) dataset))
  (funcall cont val))

;;; "Grid" (two variables)
(define-class <faceting-grid> (<faceting>)
  (var1 var2))

#+ (or)
(dohash ((key dataset-1) (group-by (var1 facet) dataset))
  (dohash ((key dataset-2) (group-by (var2 facet)) dataset-1)
    (funcall cont val)))

Changes to Code/layer.lisp.

︙︙
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24



25
26
27
28
29
30
31
32
33
34
   dataset
   statistical-transformation
   position-adjustment
   trained-dataset)
  (:default-initargs :statistical-transformation +stat-identity+
                     :position-adjustment +position-identity+))

(defun merge-aesthetics (plot layer)
  (loop with aesthetics = (append (aesthetics layer) (aesthetics plot))
        for (aes src) on aesthetics by #'cddr
        unless (member aes keys)
          collect aes into keys
          and append (list aes src) into result
        finally (return result)))




(defun train-layer (plot layer)
  (let ((dataset (or (dataset layer) (dataset plot)))
        (aesthetics (merge-aesthetics plot layer))
        (scales (scales plot))
        (stat-tr (statistical-transformation layer))
        (pos-adj (position-adjustment layer)))
    (setf dataset (bind-data aesthetics dataset)
          dataset (scale-data scales dataset)
          dataset (stat-data stat-tr dataset)
          dataset (train-scales scales dataset)







|







>
>
>

|
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
   dataset
   statistical-transformation
   position-adjustment
   trained-dataset)
  (:default-initargs :statistical-transformation +stat-identity+
                     :position-adjustment +position-identity+))

(defun layer-aesthetics (plot layer)
  (loop with aesthetics = (append (aesthetics layer) (aesthetics plot))
        for (aes src) on aesthetics by #'cddr
        unless (member aes keys)
          collect aes into keys
          and append (list aes src) into result
        finally (return result)))

(defun layer-dataset (plot layer)
  (or (dataset layer) (dataset plot)))

(defun train-layer (plot layer)
  (let ((dataset (layer-dataset plot layer))
        (aesthetics (layer-aesthetics plot layer))
        (scales (scales plot))
        (stat-tr (statistical-transformation layer))
        (pos-adj (position-adjustment layer)))
    (setf dataset (bind-data aesthetics dataset)
          dataset (scale-data scales dataset)
          dataset (stat-data stat-tr dataset)
          dataset (train-scales scales dataset)
︙︙