diff --git a/openskistats/analyze.py b/openskistats/analyze.py index 7ac6ddf0c7..d5a0406056 100644 --- a/openskistats/analyze.py +++ b/openskistats/analyze.py @@ -482,6 +482,7 @@ def ski_rose_the_world(min_combined_vertical: int = 10_000) -> None: from openskistats.plot_runs import ( RunLatitudeBearingHistogram, plot_bearing_by_latitude_bin, + plot_run_difficulty_histograms_by_slope, ) from openskistats.plot_ski_areas import ( plot_ski_area_metric_ecdfs, @@ -491,6 +492,12 @@ def ski_rose_the_world(min_combined_vertical: int = 10_000) -> None: figures["latitude_histogram"] = ( RunLatitudeBearingHistogram().plot_latitude_histogram().draw() ) + figures["slope_by_difficulty_distributions_full"] = ( + plot_run_difficulty_histograms_by_slope(condense_difficulty=False).draw() + ) + figures["slope_by_difficulty_distributions_condensed"] = ( + plot_run_difficulty_histograms_by_slope(condense_difficulty=True).draw() + ) lorenz_plot, gini_plot = plot_ski_area_metric_ecdfs() figures["ski_area_lorenz_curves"] = lorenz_plot.draw() figures["ski_area_gini_bars"] = gini_plot.draw() diff --git a/openskistats/plot_runs.py b/openskistats/plot_runs.py index 62c067ae3c..ab3f49b9d2 100644 --- a/openskistats/plot_runs.py +++ b/openskistats/plot_runs.py @@ -13,6 +13,7 @@ get_cut_bearing_bins_df, ) from openskistats.models import SkiRunDifficulty +from openskistats.plot import NARROW_SPACE from openskistats.utils import pl_flip_bearing, pl_hemisphere @@ -347,7 +348,7 @@ def plot_run_difficulty_histograms_by_slope( ) .with_columns( label=pl.struct("runs_count", "combined_vertical").map_elements( - lambda x: f"{x['runs_count']:,} runs\n{x['combined_vertical'] / 1_000:,.0f} km vert", + lambda x: f"{x['runs_count']:,} runs\n{x['combined_vertical'] / 1_000:,.0f}{NARROW_SPACE}km vert", return_dtype=pl.String, ) ) @@ -384,12 +385,12 @@ def plot_run_difficulty_histograms_by_slope( breaks=np.arange(0, 90, 10), labels=lambda values: [f"{x:.0f}°" for x in values], expand=(0, 0), - limits=(0, 42), ) + pn.scale_y_continuous( name="Combined Vertical (km)", labels=lambda values: [f"{x / 1_000:.0f}" for x in values], ) + + pn.coord_cartesian(xlim=(0, 42)) + pn.theme_bw() + pn.theme( figure_size=(3, len(colormap)),