|
96 | 96 | " \"n_stops\", \"num_stop_times\", \"daily_arrivals\", 'n_days_schedule_and_rt'\n", |
97 | 97 | "]\n", |
98 | 98 | "\n", |
99 | | - "vp_cols = ['vp_messages_per_minute', 'pct_vp_trips', 'pct_vp_routes'] #'daily_vp_trips'\n", |
100 | | - "tu_cols =['tu_messages_per_minute', 'pct_tu_trips', 'pct_tu_routes'] #'daily_tu_trips',\n", |
| 99 | + "vp_cols = ['vp_messages_per_minute', 'pct_vp_trips', 'pct_vp_routes'] \n", |
| 100 | + "tu_cols =['tu_messages_per_minute', 'pct_tu_trips', 'pct_tu_routes']\n", |
101 | 101 | "\n", |
102 | 102 | "tu_prediction_cols = [\n", |
103 | 103 | " \"bus_catch_likelihood\", \"pct_tu_complete_minutes\", # both are percents\n", |
|
369 | 369 | "# maybe IQR doesn't make sense to color, it'll just be ranked by day_type" |
370 | 370 | ] |
371 | 371 | }, |
| 372 | + { |
| 373 | + "cell_type": "code", |
| 374 | + "execution_count": null, |
| 375 | + "id": "b3950f3e-2e99-4da9-bc2d-78f61ab2806b", |
| 376 | + "metadata": {}, |
| 377 | + "outputs": [], |
| 378 | + "source": [ |
| 379 | + "pct_category_df = prep_operator_data.reshape_prediction_category_counts_to_long(df)\n", |
| 380 | + "\n", |
| 381 | + "category_counts_stacked_bar = alt.Chart(pct_category_df).mark_bar().encode(\n", |
| 382 | + " x=alt.X(\n", |
| 383 | + " 'day_type',\n", |
| 384 | + " title = \"\", sort=[\"Weekday\", \"Saturday\", \"Sunday\"]\n", |
| 385 | + " ),\n", |
| 386 | + " y=alt.Y('pct', title=\"Percent\"),\n", |
| 387 | + " color=alt.Color(\n", |
| 388 | + " 'prediction_category:N',\n", |
| 389 | + " title=\"Prediction Category\", \n", |
| 390 | + " sort=[\"early\", \"ontime\", \"late\"],\n", |
| 391 | + " scale=alt.Scale(range=[\n", |
| 392 | + " _color_palette.get_color(\"light_cadmium_yellow\"),\n", |
| 393 | + " _color_palette.get_color(\"electric_orange\"),\n", |
| 394 | + " _color_palette.get_color(\"aquatic\")\n", |
| 395 | + " ])\n", |
| 396 | + " ),\n", |
| 397 | + " column=alt.Column(\"tu_name\", title = \"\"),\n", |
| 398 | + " tooltip=[\"tu_name\", \"day_type\", \"prediction_category\", \"pct\"]\n", |
| 399 | + ").interactive().properties(\n", |
| 400 | + " title = \"Predictions by Category\",\n", |
| 401 | + " width=150, height = 200\n", |
| 402 | + ")\n", |
| 403 | + "\n", |
| 404 | + "category_counts_stacked_bar" |
| 405 | + ] |
| 406 | + }, |
372 | 407 | { |
373 | 408 | "cell_type": "markdown", |
374 | 409 | "id": "3033b010-f091-4a32-8df1-38dc7d2fd3af", |
|
0 commit comments