示例#1
0
    def plot_all_regional_error_metrics(
        self,
        gdf: GeoDataFrame,  # type: ignore
        title: str = "",
        **kwargs: Dict,
    ) -> Tuple[Figure, List[Axes]]:
        """Plot area-based maps of the scores"""
        assert np.isin(["rmse", "mae", "r2"],
                       gdf.columns).all()  # type: ignore
        gdf = gdf.dropna(subset=["rmse", "mae", "r2"])  # type: ignore

        # get the PlotMetric objects
        rmse = self.get_metric("rmse", gdf, **kwargs)
        mae = self.get_metric("mae", gdf, **kwargs)
        r2 = self.get_metric("r2", gdf, **kwargs)

        # build multi-axis plot
        fig, axs = plt.subplots(1, 3, figsize=(12, 8))
        for i, metric in enumerate([rmse, mae, r2]):
            ax = axs[i]
            ax = self.plot_metric(gdf=gdf, ax=ax, metric=metric)
            ax.axis("off")

        fig.suptitle(title)
        return fig, axs
    def plot_regional_error_metric(
            self,
            gdf: GeoDataFrame,  # type: ignore
            selection: str) -> Tuple[Figure, Axes]:
        valid_metrics = ['rmse', 'mae', 'r2']
        assert selection in valid_metrics, 'Expecting selection' \
            f' to be one of: {valid_metrics}'
        gdf = gdf.dropna(subset=valid_metrics)  # type: ignore
        metric = self.get_metric(selection)
        fig, ax = plt.subplots()
        ax = self.plot_metric(gdf=gdf, ax=ax, metric=metric)

        return fig, ax
示例#3
0
    def plot_regional_error_metric(
        self,
        gdf: GeoDataFrame,  # type: ignore
        selection: str,
        **kwargs: Dict,
    ) -> Tuple[Figure, Axes]:
        valid_metrics = ["rmse", "mae", "r2"]
        assert selection in valid_metrics, ("Expecting selection"
                                            f" to be one of: {valid_metrics}")
        gdf = gdf.dropna(subset=valid_metrics)  # type: ignore
        metric = self.get_metric(selection, gdf, **kwargs)
        fig, ax = plt.subplots()
        ax = self.plot_metric(gdf=gdf, ax=ax, metric=metric)

        return fig, ax
    def plot_all_regional_error_metrics(
            self,
            gdf: GeoDataFrame,  # type: ignore
            title: str = '') -> Tuple[Figure, List[Axes]]:
        """Plot area-based maps of the scores"""
        assert np.isin(['rmse', 'mae', 'r2'],
                       gdf.columns).all()  # type: ignore
        gdf = gdf.dropna(subset=['rmse', 'mae', 'r2'])  # type: ignore

        # get the PlotMetric objects
        rmse = self.get_metric('rmse')
        mae = self.get_metric('mae')
        r2 = self.get_metric('r2')

        # build multi-axis plot
        fig, axs = plt.subplots(1, 3, figsize=(24, 6))
        for i, metric in enumerate([rmse, mae, r2]):
            ax = axs[i]
            ax = self.plot_metric(gdf=gdf, ax=ax, metric=metric)

        fig.set_suptitle(title)
        return fig, axs