|
144 | 144 |
|
145 | 145 | ;;; # Here's a more scientific example |
146 | 146 |
|
147 | | -(def iris |
148 | | - (json/read-str (slurp "https://storage.googleapis.com/kagglesdsdata/datasets/20079/26025/iris.json?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=gcp-kaggle-com%40kaggle-161607.iam.gserviceaccount.com%2F20251129%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20251129T050349Z&X-Goog-Expires=259200&X-Goog-SignedHeaders=host&X-Goog-Signature=a076da9c0375641bed362393229356cd341ab694a356bbbadb6678f654ef58880b12de60a307cff229fc845e66a05acc14621bc4a6a022fc6419e0431327bc9b8105ca66e8289bd4b030825dfb5e0aaa7b0824bb9ebe9ed087c23329fb8a9259c86d0bccfdfe4da1f4d7ae84a91e14dc0df16aa011afecaa2daa1a96d83efc170e2d50758690b22e9b1fb289a476786d15f756e84724706c5581389462938de2a7d6d7ec38e20a7d7edc9b143ddef286e462f07c7827900a9e2130ca41cf21ce7da1e540d599d6bec333a0eae26af1532bf2ba745fd07e197226fb75795b1655aab3f62d097fa9be56a907e8c98601deb5c6c880e5ccc00617752ea92518f945"))) |
| 147 | +(def iris-url "https://gist.githubusercontent.com/curran/a08a1080b88344b0c8a7/raw/0e7a9b0a5d22642a06d3d5b9bcbad9890c8ee534/iris.csv") |
149 | 148 |
|
150 | 149 | ^:kind/vega-lite |
151 | | -(violin-plot {:values iris} "petalWidth" "species" 0 4) |
| 150 | +(violin-plot {:url iris-url |
| 151 | + :format "csv"} |
| 152 | + "petal_width" "species" |
| 153 | + 0 4) |
| 154 | + |
| 155 | +^:kind/vega-lite |
| 156 | + {:mark {:type "boxplot"} |
| 157 | + :data {:url iris-url |
| 158 | + :format "csv"} |
| 159 | + :encoding |
| 160 | + {"x" {:field "petal_width" |
| 161 | + :type "quantitative"} |
| 162 | + "y" {:field "species" |
| 163 | + :type "nominal"} |
| 164 | + "color" {:field "species" :type "nominal" :legend false} |
| 165 | + } |
| 166 | + :width 800 |
| 167 | + } |
| 168 | + |
152 | 169 |
|
153 | 170 | ^:kind/vega-lite |
154 | 171 | (violin-plot {:url penguin-data-url |
|
208 | 225 | { |
209 | 226 | ;; Data is in common |
210 | 227 | :data data |
211 | | - |
| 228 | + :config {:facet {:spacing 0} |
| 229 | + :view {:stroke nil}} |
212 | 230 | :facet |
213 | 231 | {:row {:field group-field |
214 | 232 | :type "nominal" |
215 | | - :spacing 0 ;??? not working |
216 | | - :header {:labelAngle 0 :labelAlign "left"} |
217 | | - }} |
| 233 | + :header {:labelAngle 0 |
| 234 | + :labelAlign "left" |
| 235 | + } |
| 236 | + } |
| 237 | + } |
218 | 238 |
|
219 | 239 | :spec |
220 | 240 | { |
|
238 | 258 | }} |
239 | 259 |
|
240 | 260 | ;; box layer |
241 | | - ;; TODO turn off outliers, widen box |
242 | | - {:mark {:type "boxplot" :outliers false} |
| 261 | + ;; TODO widen box |
| 262 | + {:mark {:type "boxplot" |
| 263 | + :outliers false} ;turn off outlier points since we draw all points |
243 | 264 | :encoding |
244 | 265 | {:color {:field group-field :type "nominal" :legend false} |
245 | 266 | }}] |
246 | | - :width 800 |
| 267 | + :width 800 |
247 | 268 | } |
248 | 269 |
|
249 | 270 | }) |
250 | 271 |
|
| 272 | +^:kind/vega-lite |
| 273 | +(box-dot-plot {:url penguin-data-url |
| 274 | + :format {:type "tsv"}} |
| 275 | + "flipper_length_mm" "species island" |
| 276 | + 150 250) |
251 | 277 |
|
| 278 | +;;; Let's try that for the movies |
252 | 279 |
|
253 | 280 | ^:kind/vega-lite |
254 | | -(box-dot-plot {:url penguin-data-url |
255 | | - :format {:type "tsv"} |
256 | | - } |
257 | | - "flipper_length_mm" "species island" |
258 | | - 150 250 |
259 | | - ) |
| 281 | +(box-dot-plot {:values movie-data} |
| 282 | + "US Gross" "Major Genre" |
| 283 | + 0 500000000) |
0 commit comments