diff --git a/geoutils/raster/raster.py b/geoutils/raster/raster.py index 8c3e9116..d84dffac 100644 --- a/geoutils/raster/raster.py +++ b/geoutils/raster/raster.py @@ -2100,7 +2100,7 @@ def reproject( (dst_transform == self.transform) or (dst_transform is None), (dst_crs == self.crs) or (dst_crs is None), (dst_size == self.shape[::-1]) or (dst_size is None), - np.all(dst_res == self.res) or (dst_res == self.res[0] == self.res[1]) or (dst_res is None), + np.all(np.array(dst_res) == self.res) or (dst_res is None), ] ): if (dst_nodata == self.nodata) or (dst_nodata is None): @@ -2514,12 +2514,7 @@ def show( # Create axes if ax is None: - # If no figure exists, get a new axis - if len(plt.get_fignums()) == 0: - ax0 = plt.gca() - # Otherwise, get first axis - else: - ax0 = plt.gcf().axes[0] + ax0 = plt.gca() elif isinstance(ax, str) and ax.lower() == "new": _, ax0 = plt.subplots() elif isinstance(ax, matplotlib.axes.Axes): diff --git a/tests/test_raster.py b/tests/test_raster.py index ba87c60d..2790c82d 100644 --- a/tests/test_raster.py +++ b/tests/test_raster.py @@ -2147,6 +2147,23 @@ def test_show(self) -> None: img_RGB = gu.Raster(self.landsat_rgb_path) # Test default plot + img.show() + if DO_PLOT: + plt.show() + else: + plt.close() + assert True + + # Test with new figure + plt.figure() + img.show() + if DO_PLOT: + plt.show() + else: + plt.close() + assert True + + # Test with provided ax ax = plt.subplot(111) img.show(ax=ax, title="Simple plotting test") if DO_PLOT: