Exemple #1
0
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 draw(self, ax: plt.Subplot, c: str = 'k', lw: int = 1, **kwargs):
        """
        draw this rect

        Parameters
        ----------
        ax
            subplot object to use for the plotting
        c
            color argument passed to plot
        lw
            linewidth argument passed to plot
        """

        ax.plot([
            self.west_edge, self.east_edge, self.east_edge, self.west_edge,
            self.west_edge
        ], [
            self.north_edge, self.north_edge, self.south_edge, self.south_edge,
            self.north_edge
        ],
                c=c,
                lw=lw,
                **kwargs)