@@ -4339,13 +4339,12 @@ iris
43394339
43404340; ; ### 🧪 Example 24: Faceted Scatter with Plotly
43414341
4342- (plot
4343- (-> penguins
4344- (mapping :bill-length-mm :bill-depth-mm )
4345- (scatter )
4346- (facet {:col :species })
4347- (target :plotly )
4348- (size 800 400 )))
4342+ (-> penguins
4343+ (mapping :bill-length-mm :bill-depth-mm )
4344+ (scatter )
4345+ (facet {:col :species })
4346+ (target :plotly )
4347+ (size 800 400 ))
43494348
43504349(kind/test-last [#(and (map? %)
43514350 (contains? % :data )
@@ -4400,35 +4399,20 @@ iris
44004399 (= (:=height %) 600 )
44014400 (= (:=target %) :vl ))])
44024401
4403- ; ; **Full threading with `plot`**:
4404- ; ; The `plot` function also supports threading, so you can optionally call it
4405- ; ; explicitly at the end of your pipeline (though auto-display usually handles this):
4406- (-> penguins
4407- (mapping :bill-length-mm :bill-depth-mm {:color :species })
4408- (scatter {:alpha 0.7 })
4409- (target :plotly )
4410- (size 1000 500 )
4411- (plot ))
4412-
4413- (kind/test-last [#(map? (meta %))])
4414-
44154402; ; **What happens here**:
44164403
44174404; ; 1. `size` adds `:=width` and `:=height` to the plot spec (plot-level properties)
44184405; ; 2. `plot-impl` methods check spec first, then opts, then defaults
44194406; ; 3. Priority: `:=width` > `:width opts` > `(:plot-width theme)`
44204407; ; 4. Fully compositional - size is part of the plot spec, not external config
44214408
4422- ; ; **Backwards compatibility**:
4423- ; ; The old pattern still works - `plot` with opts map:
4424- (plot
4425- (-> penguins
4426- (mapping :bill-length-mm :bill-depth-mm )
4427- (scatter )
4428- (target :vl ))
4429- {:width 800 :height 600 })
4430-
4431- (kind/test-last [#(map? (meta %))])
4409+ ; ; Size arguments can also be passed directly to the `plot` function:
4410+ (-> penguins
4411+ (mapping :bill-length-mm :bill-depth-mm )
4412+ (scatter )
4413+ (facet {:row :island :col :sex })
4414+ (target :vl )
4415+ (plot {:width 800 :height 600 }))
44324416
44334417; ; Both approaches work. The `size` constructor enables full threading and
44344418; ; treats dimensions as compositional layer properties.
0 commit comments