| 239 | } |
| 240 | |
| 241 | fn mixed_grid_example() { |
| 242 | // 2D cartesian scatter (baseline) |
| 243 | let penguins = CsvReader::new("data/penguins.csv") |
| 244 | .finish() |
| 245 | .unwrap() |
| 246 | .lazy() |
| 247 | .select([ |
| 248 | col("species"), |
| 249 | col("bill_length_mm"), |
| 250 | col("flipper_length_mm"), |
| 251 | col("body_mass_g"), |
| 252 | ]) |
| 253 | .collect() |
| 254 | .unwrap(); |
| 255 | |
| 256 | let scatter_2d = ScatterPlot::builder() |
| 257 | .data(&penguins) |
| 258 | .x("bill_length_mm") |
| 259 | .y("flipper_length_mm") |
| 260 | .group("species") |
| 261 | .opacity(0.65) |
| 262 | .size(10) |
| 263 | .plot_title(Text::from("Penguins 2D").y(1.3)) |
| 264 | .build(); |
| 265 | |
| 266 | // 3D scene subplot |
| 267 | let scatter_3d = Scatter3dPlot::builder() |
| 268 | .data(&penguins) |
| 269 | .x("bill_length_mm") |
| 270 | .y("flipper_length_mm") |
| 271 | .z("body_mass_g") |
| 272 | .group("species") |
| 273 | .opacity(0.35) |
| 274 | .size(6) |
| 275 | .plot_title(Text::from("Penguins 3D").y(1.45)) |
| 276 | .build(); |
| 277 | |
| 278 | // Polar subplot |
| 279 | let polar_df = CsvReader::new("data/product_comparison_polar.csv") |
| 280 | .finish() |
| 281 | .unwrap(); |
| 282 | |
| 283 | let polar = ScatterPolar::builder() |
| 284 | .data(&polar_df) |
| 285 | .theta("angle") |
| 286 | .r("score") |
| 287 | .group("product") |
| 288 | .mode(Mode::LinesMarkers) |
| 289 | .size(10) |
| 290 | .plot_title(Text::from("Product Comparison (Polar)").y(1.5).x(0.72)) |
| 291 | .legend(&Legend::new().x(0.8)) |
| 292 | .build(); |
| 293 | |
| 294 | // Domain-based subplot (Sankey) |
| 295 | let sankey_df = CsvReader::new("data/energy_transition.csv") |
| 296 | .finish() |
| 297 | .unwrap(); |
| 298 | |