def plot_stop_accessibility_cdf(subplot: Subplot, result: CrossStopRemovalResult): """Plot the accessibility difference in ``result`` as a subplot onto ``subplot``.""" # pylint: disable=invalid-name # Configure plot subplot.set_xlabel("Distance to stop (km)", size=20) subplot.set_ylabel("Percentile", size=20) subplot.set_title(result.stop_removed.cross_name, size=24) # Plot CDF x, y = result.metrics_before.get_quantile_cdf(20) subplot.plot(x, y, label="Before") x, y = result.metrics_after.get_quantile_cdf(20) subplot.plot(x, y, label="After") # Post-configure the plot subplot.legend(loc="upper right")
def plot_stop_accessibility_hist(subplot: Subplot, result: CrossStopRemovalResult): """Plot the accessibility difference in ``result`` as a subplot onto ``subplot``.""" # ----- Plot histogram # https://datavizpyr.com/overlapping-histograms-with-matplotlib-in-python/ # Configure plot subplot.set_xlabel("Distance to stop (km)", size=14) subplot.set_ylabel("Agent count", size=14) subplot.set_title( f"Distance to stop between before and after removing {result.stop_removed.cross_name}" ) # Plot histograms subplot.hist(result.metrics_before.data, bins=20, alpha=0.5, label="Before") subplot.hist(result.metrics_after.data, bins=20, alpha=0.5, label="After") # Post-configure the plot subplot.legend(loc="upper right")