|
2193 | 2193 | :hist-rects hist-rects})) |
2194 | 2194 |
|
2195 | 2195 | (defn- get-scale-domain |
2196 | | - "Extract custom domain for an aesthetic from layers, or return nil if not specified." |
2197 | | - [layers-vec aesthetic] |
| 2196 | + "Extract custom domain for an aesthetic from plot spec, or return nil if not specified. |
| 2197 | + |
| 2198 | + Args: |
| 2199 | + - spec: Plot specification map (not layers-vec) |
| 2200 | + - aesthetic: Keyword like :x, :y, :color |
| 2201 | + |
| 2202 | + Returns: |
| 2203 | + - Domain vector [min max] or nil if not specified" |
| 2204 | + [spec aesthetic] |
2198 | 2205 | (let [scale-key (keyword (str "=scale-" (name aesthetic)))] |
2199 | | - (some #(get-in % [scale-key :domain]) layers-vec))) |
| 2206 | + (get-in spec [scale-key :domain]))) |
2200 | 2207 |
|
2201 | 2208 | ;; Render plot using thi.ng/geom to static SVG. |
2202 | 2209 | ;; |
|
2237 | 2244 | panel-height (/ height num-rows) |
2238 | 2245 |
|
2239 | 2246 | ;; Check for custom scale domains |
2240 | | - custom-x-domain (get-scale-domain layers-vec :x) |
2241 | | - custom-y-domain (get-scale-domain layers-vec :y) |
| 2247 | + custom-x-domain (get-scale-domain spec :x) |
| 2248 | + custom-y-domain (get-scale-domain spec :y) |
2242 | 2249 |
|
2243 | 2250 | ;; Compute transformed points for ALL facets (for shared domain) |
2244 | 2251 | all-transformed-points |
@@ -3786,8 +3793,8 @@ iris |
3786 | 3793 | col-var (when is-faceted? (some :=col layers-vec)) |
3787 | 3794 |
|
3788 | 3795 | ;; Check for custom scale domains |
3789 | | - custom-x-domain (get-scale-domain layers-vec :x) |
3790 | | - custom-y-domain (get-scale-domain layers-vec :y) |
| 3796 | + custom-x-domain (get-scale-domain spec :x) |
| 3797 | + custom-y-domain (get-scale-domain spec :y) |
3791 | 3798 |
|
3792 | 3799 | ;; Create context map for render-layer |
3793 | 3800 | context {:custom-x-domain custom-x-domain |
@@ -3962,8 +3969,8 @@ iris |
3962 | 3969 | col-var (when is-faceted? (some :=col layers-vec)) |
3963 | 3970 |
|
3964 | 3971 | ;; Check for custom scale domains |
3965 | | - custom-x-domain (get-scale-domain layers-vec :x) |
3966 | | - custom-y-domain (get-scale-domain layers-vec :y) |
| 3972 | + custom-x-domain (get-scale-domain spec :x) |
| 3973 | + custom-y-domain (get-scale-domain spec :y) |
3967 | 3974 |
|
3968 | 3975 | ;; Create context map for render-layer |
3969 | 3976 | context {:custom-x-domain custom-x-domain |
|
0 commit comments