From 56f5c546b1cabf72356fd440d597f4062fbca47a Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Mon, 2 Aug 2021 09:28:28 +0300 Subject: [PATCH 01/26] adding if statement for geopandas default behavior. --- pygmt/src/plot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index df87972074a..f53d9af3f1f 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -209,6 +209,8 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): extra_arrays = [] if "S" in kwargs and kwargs["S"][0] in "vV" and direction is not None: extra_arrays.extend(direction) + elif "S" not in kwargs and data is not None and '_geometry_column_name' in data.__dict__ and (data.geom_type == 'Point').all(): + kwargs["S"] = 's0.2c' if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": raise GMTInvalidInput( From ef2e89a4f3f236ebcdf2b1382ccb05742e9b9f8c Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Mon, 2 Aug 2021 09:38:46 +0300 Subject: [PATCH 02/26] format corections --- pygmt/src/plot.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index f53d9af3f1f..8ae9d547b0c 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -209,8 +209,13 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): extra_arrays = [] if "S" in kwargs and kwargs["S"][0] in "vV" and direction is not None: extra_arrays.extend(direction) - elif "S" not in kwargs and data is not None and '_geometry_column_name' in data.__dict__ and (data.geom_type == 'Point').all(): - kwargs["S"] = 's0.2c' + elif ( + "S" not in kwargs + and data is not None + and "_geometry_column_name" in data.__dict__ + and (data.geom_type == "Point").all() + ): + kwargs["S"] = "s0.2c" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": raise GMTInvalidInput( From af36475a9e8cf2ea75ecb16ad1586a54527b9cba Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Mon, 2 Aug 2021 10:03:44 +0300 Subject: [PATCH 03/26] chcking that data is an object to be sure it has __dict__ (make sure it is not a string) --- pygmt/src/plot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index 8ae9d547b0c..5332d7f0d98 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -212,6 +212,7 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): elif ( "S" not in kwargs and data is not None + and data is object and "_geometry_column_name" in data.__dict__ and (data.geom_type == "Point").all() ): From e1543e809d791d604233d082f56a7be990466311 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Mon, 2 Aug 2021 15:23:11 +0300 Subject: [PATCH 04/26] Update pygmt/src/plot.py Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/src/plot.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index 5332d7f0d98..b0a3fc17195 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -212,8 +212,7 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): elif ( "S" not in kwargs and data is not None - and data is object - and "_geometry_column_name" in data.__dict__ + and kind == "geojson" and (data.geom_type == "Point").all() ): kwargs["S"] = "s0.2c" From d60ee1b331e78e3ac0730abb95c49e30b33b3ab1 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Mon, 2 Aug 2021 15:29:07 +0300 Subject: [PATCH 05/26] not checking if data is not None allrady been verefide in data_kind function --- pygmt/src/plot.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index b0a3fc17195..39697c77a61 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -211,7 +211,6 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): extra_arrays.extend(direction) elif ( "S" not in kwargs - and data is not None and kind == "geojson" and (data.geom_type == "Point").all() ): From 4bd2d5ed0f76770a146ac8a2f52acb06cb39c2aa Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Tue, 3 Aug 2021 07:54:01 +0300 Subject: [PATCH 06/26] reformat style --- pygmt/src/plot.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index 39697c77a61..41ef241e199 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -209,11 +209,7 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): extra_arrays = [] if "S" in kwargs and kwargs["S"][0] in "vV" and direction is not None: extra_arrays.extend(direction) - elif ( - "S" not in kwargs - and kind == "geojson" - and (data.geom_type == "Point").all() - ): + elif "S" not in kwargs and kind == "geojson" and (data.geom_type == "Point").all(): kwargs["S"] = "s0.2c" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": From 93c53129ad6a260aab0630eb63ea2245516d97b3 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Tue, 3 Aug 2021 08:10:25 +0300 Subject: [PATCH 07/26] Update pygmt/src/plot.py Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/src/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index 41ef241e199..e98eb2af9f3 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -210,7 +210,7 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): if "S" in kwargs and kwargs["S"][0] in "vV" and direction is not None: extra_arrays.extend(direction) elif "S" not in kwargs and kind == "geojson" and (data.geom_type == "Point").all(): - kwargs["S"] = "s0.2c" + kwargs["S"] = "p" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": raise GMTInvalidInput( From 5daeb42ab1caaa9d27d433751c763536f85265b3 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Tue, 3 Aug 2021 08:11:57 +0300 Subject: [PATCH 08/26] Update pygmt/src/plot.py Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/src/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index e98eb2af9f3..21d02a57d78 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -209,7 +209,7 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): extra_arrays = [] if "S" in kwargs and kwargs["S"][0] in "vV" and direction is not None: extra_arrays.extend(direction) - elif "S" not in kwargs and kind == "geojson" and (data.geom_type == "Point").all(): + elif "S" not in kwargs and kind == "geojson" and data.geom_type.isin(["Point", "MultiPoint"]).all(): kwargs["S"] = "p" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": From 2041146a93847e0cdfab9f9fbe8146e70c7e9b0c Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Tue, 3 Aug 2021 08:17:24 +0300 Subject: [PATCH 09/26] adding the if statment to plot3d.py --- pygmt/src/plot.py | 6 +++++- pygmt/src/plot3d.py | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index 21d02a57d78..2d40223d93b 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -209,7 +209,11 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): extra_arrays = [] if "S" in kwargs and kwargs["S"][0] in "vV" and direction is not None: extra_arrays.extend(direction) - elif "S" not in kwargs and kind == "geojson" and data.geom_type.isin(["Point", "MultiPoint"]).all(): + elif ( + "S" not in kwargs + and kind == "geojson" + and data.geom_type.isin(["Point", "MultiPoint"]).all() + ): kwargs["S"] = "p" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": diff --git a/pygmt/src/plot3d.py b/pygmt/src/plot3d.py index 7a591c9c11f..e6dcb84626e 100644 --- a/pygmt/src/plot3d.py +++ b/pygmt/src/plot3d.py @@ -178,6 +178,12 @@ def plot3d( extra_arrays = [] if "S" in kwargs and kwargs["S"][0] in "vV" and direction is not None: extra_arrays.extend(direction) + elif ( + "S" not in kwargs + and kind == "geojson" + and data.geom_type.isin(["Point", "MultiPoint"]).all() + ): + kwargs["S"] = "p" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": raise GMTInvalidInput( From 9f69437a8fb18d4229aa4892a1895f8d42de9910 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Tue, 3 Aug 2021 09:16:59 +0300 Subject: [PATCH 10/26] changing the style to s-.2c and u0.2c for plot and plot3d respectivly --- pygmt/src/plot.py | 2 +- pygmt/src/plot3d.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index 2d40223d93b..287116d9e89 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -214,7 +214,7 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): and kind == "geojson" and data.geom_type.isin(["Point", "MultiPoint"]).all() ): - kwargs["S"] = "p" + kwargs["S"] = "s0.2c" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": raise GMTInvalidInput( diff --git a/pygmt/src/plot3d.py b/pygmt/src/plot3d.py index e6dcb84626e..28ef858726e 100644 --- a/pygmt/src/plot3d.py +++ b/pygmt/src/plot3d.py @@ -183,7 +183,7 @@ def plot3d( and kind == "geojson" and data.geom_type.isin(["Point", "MultiPoint"]).all() ): - kwargs["S"] = "p" + kwargs["S"] = "u0.2c" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": raise GMTInvalidInput( From 6409d34d9f763800e3889a32acb4695d6c1be7cc Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Wed, 4 Aug 2021 08:42:40 +0300 Subject: [PATCH 11/26] testing defualt behavior of plot and plot3d with geopandas Point and MultiPoint DataFrames --- ...test_geopandas_plot3d_default_cube.png.dvc | 4 +++ ...test_geopandas_plot_default_square.png.dvc | 4 +++ pygmt/tests/test_geopandas.py | 34 ++++++++++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 pygmt/tests/baseline/test_geopandas_plot3d_default_cube.png.dvc create mode 100644 pygmt/tests/baseline/test_geopandas_plot_default_square.png.dvc diff --git a/pygmt/tests/baseline/test_geopandas_plot3d_default_cube.png.dvc b/pygmt/tests/baseline/test_geopandas_plot3d_default_cube.png.dvc new file mode 100644 index 00000000000..3cfea24ebfa --- /dev/null +++ b/pygmt/tests/baseline/test_geopandas_plot3d_default_cube.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 97329f92f899eaab2fc3b5dd7eac4a28 + size: 101975 + path: test_geopandas_plot3d_default_cube.png diff --git a/pygmt/tests/baseline/test_geopandas_plot_default_square.png.dvc b/pygmt/tests/baseline/test_geopandas_plot_default_square.png.dvc new file mode 100644 index 00000000000..a0b9c4aef46 --- /dev/null +++ b/pygmt/tests/baseline/test_geopandas_plot_default_square.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: f38930acf3b735181a10277a3ffbfd3e + size: 11198 + path: test_geopandas_plot_default_square.png diff --git a/pygmt/tests/test_geopandas.py b/pygmt/tests/test_geopandas.py index d7f04e6cb45..79c46f4e79a 100644 --- a/pygmt/tests/test_geopandas.py +++ b/pygmt/tests/test_geopandas.py @@ -3,7 +3,7 @@ """ import numpy.testing as npt import pytest -from pygmt import info +from pygmt import info, Figure gpd = pytest.importorskip("geopandas") shapely = pytest.importorskip("shapely") @@ -64,3 +64,35 @@ def test_geopandas_info_shapely(gdf, geomtype, desired): geom = gdf.loc[geomtype].geometry output = info(table=geom, per_column=True) npt.assert_allclose(actual=output, desired=desired) + + +@pytest.mark.mpl_image_compare +def test_geopandas_plot_default_square(): + """ + """ + point = shapely.geometry.Point(5, 5) + gdf = gpd.GeoDataFrame(dict(geometry=[point])) + fig = Figure() + fig.plot(data=gdf, region=[0, 10, 0, 10], projection='X10', frame=True) + return fig + + +@pytest.mark.mpl_image_compare +def test_geopandas_plot3d_default_cube(): + mp = shapely.geometry.MultiPoint([(5, 5, 5), (2, 2, 2)]) + gdf = gpd.GeoDataFrame(dict(geometry=[mp])) + fig = Figure() + fig.plot3d( + data=gdf, + perspective=[315, 25], + region=[0, 10, 0, 10, 0, 10], + frame=[ + 'wsnez3', + 'xafg', + 'yafg', + 'zafg', + ], + zscale=1.5, + ) + return fig + From 7a60c4f57695cbcc366c5335be2ea24e8de2fcec Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Wed, 4 Aug 2021 08:45:24 +0300 Subject: [PATCH 12/26] style reformat --- pygmt/tests/test_geopandas.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pygmt/tests/test_geopandas.py b/pygmt/tests/test_geopandas.py index 79c46f4e79a..0ba147d8289 100644 --- a/pygmt/tests/test_geopandas.py +++ b/pygmt/tests/test_geopandas.py @@ -3,7 +3,7 @@ """ import numpy.testing as npt import pytest -from pygmt import info, Figure +from pygmt import Figure, info gpd = pytest.importorskip("geopandas") shapely = pytest.importorskip("shapely") @@ -68,12 +68,11 @@ def test_geopandas_info_shapely(gdf, geomtype, desired): @pytest.mark.mpl_image_compare def test_geopandas_plot_default_square(): - """ - """ + """ """ point = shapely.geometry.Point(5, 5) gdf = gpd.GeoDataFrame(dict(geometry=[point])) fig = Figure() - fig.plot(data=gdf, region=[0, 10, 0, 10], projection='X10', frame=True) + fig.plot(data=gdf, region=[0, 10, 0, 10], projection="X10", frame=True) return fig @@ -87,12 +86,11 @@ def test_geopandas_plot3d_default_cube(): perspective=[315, 25], region=[0, 10, 0, 10, 0, 10], frame=[ - 'wsnez3', - 'xafg', - 'yafg', - 'zafg', + "wsnez3", + "xafg", + "yafg", + "zafg", ], zscale=1.5, ) return fig - From dd1c9b8c58a44ac4bf9be918993a51050d1180e9 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Wed, 4 Aug 2021 08:49:59 +0300 Subject: [PATCH 13/26] style reformat imports --- pygmt/tests/test_geopandas.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pygmt/tests/test_geopandas.py b/pygmt/tests/test_geopandas.py index 0ba147d8289..612b545cfda 100644 --- a/pygmt/tests/test_geopandas.py +++ b/pygmt/tests/test_geopandas.py @@ -3,7 +3,8 @@ """ import numpy.testing as npt import pytest -from pygmt import Figure, info +from pygmt import Figure +from pygmt import info gpd = pytest.importorskip("geopandas") shapely = pytest.importorskip("shapely") From 1979249c9060111011b3dbf696cb1e73bc2a4a30 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Wed, 4 Aug 2021 08:55:12 +0300 Subject: [PATCH 14/26] add comments to new tests --- pygmt/tests/test_geopandas.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pygmt/tests/test_geopandas.py b/pygmt/tests/test_geopandas.py index 612b545cfda..9dd61c8c06d 100644 --- a/pygmt/tests/test_geopandas.py +++ b/pygmt/tests/test_geopandas.py @@ -69,7 +69,9 @@ def test_geopandas_info_shapely(gdf, geomtype, desired): @pytest.mark.mpl_image_compare def test_geopandas_plot_default_square(): - """ """ + """ + Check the default behavior of plotting geopandas DataFrame with Point geometry in 2d + """ point = shapely.geometry.Point(5, 5) gdf = gpd.GeoDataFrame(dict(geometry=[point])) fig = Figure() @@ -79,6 +81,9 @@ def test_geopandas_plot_default_square(): @pytest.mark.mpl_image_compare def test_geopandas_plot3d_default_cube(): + """ + Check the default behavior of plotting geopandas DataFrame with MultiPoint geometry in 3d + """ mp = shapely.geometry.MultiPoint([(5, 5, 5), (2, 2, 2)]) gdf = gpd.GeoDataFrame(dict(geometry=[mp])) fig = Figure() From 966c9e598920f7c2c144f33d24bbbf6ffcccf55a Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Thu, 5 Aug 2021 09:29:19 +0300 Subject: [PATCH 15/26] reformat imports --- pygmt/tests/test_geopandas.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pygmt/tests/test_geopandas.py b/pygmt/tests/test_geopandas.py index 9dd61c8c06d..f1c70cd3e90 100644 --- a/pygmt/tests/test_geopandas.py +++ b/pygmt/tests/test_geopandas.py @@ -3,8 +3,7 @@ """ import numpy.testing as npt import pytest -from pygmt import Figure -from pygmt import info +from pygmt import Figure, info gpd = pytest.importorskip("geopandas") shapely = pytest.importorskip("shapely") @@ -70,7 +69,8 @@ def test_geopandas_info_shapely(gdf, geomtype, desired): @pytest.mark.mpl_image_compare def test_geopandas_plot_default_square(): """ - Check the default behavior of plotting geopandas DataFrame with Point geometry in 2d + Check the default behavior of plotting geopandas DataFrame with Point + geometry in 2d. """ point = shapely.geometry.Point(5, 5) gdf = gpd.GeoDataFrame(dict(geometry=[point])) @@ -82,7 +82,8 @@ def test_geopandas_plot_default_square(): @pytest.mark.mpl_image_compare def test_geopandas_plot3d_default_cube(): """ - Check the default behavior of plotting geopandas DataFrame with MultiPoint geometry in 3d + Check the default behavior of plotting geopandas DataFrame with MultiPoint + geometry in 3d. """ mp = shapely.geometry.MultiPoint([(5, 5, 5), (2, 2, 2)]) gdf = gpd.GeoDataFrame(dict(geometry=[mp])) From 35e66d116d6c9672d5869ddfad5fa60aa8de4777 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Fri, 6 Aug 2021 14:00:59 +0300 Subject: [PATCH 16/26] Update pygmt/tests/test_geopandas.py Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/tests/test_geopandas.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pygmt/tests/test_geopandas.py b/pygmt/tests/test_geopandas.py index f1c70cd3e90..6b226ee6748 100644 --- a/pygmt/tests/test_geopandas.py +++ b/pygmt/tests/test_geopandas.py @@ -72,10 +72,10 @@ def test_geopandas_plot_default_square(): Check the default behavior of plotting geopandas DataFrame with Point geometry in 2d. """ - point = shapely.geometry.Point(5, 5) - gdf = gpd.GeoDataFrame(dict(geometry=[point])) + point = shapely.geometry.Point(1, 2) + gdf = gpd.GeoDataFrame(geometry=[point]) fig = Figure() - fig.plot(data=gdf, region=[0, 10, 0, 10], projection="X10", frame=True) + fig.plot(data=gdf, region=[0, 2, 1, 3], projection="X2c", frame=True) return fig From 1590a26918f33d456e7550ae32bc42dffee7f7b6 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Fri, 6 Aug 2021 14:01:18 +0300 Subject: [PATCH 17/26] Update pygmt/tests/test_geopandas.py Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/tests/test_geopandas.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pygmt/tests/test_geopandas.py b/pygmt/tests/test_geopandas.py index 6b226ee6748..04ba53a8a7e 100644 --- a/pygmt/tests/test_geopandas.py +++ b/pygmt/tests/test_geopandas.py @@ -85,19 +85,15 @@ def test_geopandas_plot3d_default_cube(): Check the default behavior of plotting geopandas DataFrame with MultiPoint geometry in 3d. """ - mp = shapely.geometry.MultiPoint([(5, 5, 5), (2, 2, 2)]) - gdf = gpd.GeoDataFrame(dict(geometry=[mp])) + multipoint = shapely.geometry.MultiPoint([(0.5, 0.5, 0.5), (1.5, 1.5, 1.5)]) + gdf = gpd.GeoDataFrame(geometry=[multipoint]) fig = Figure() fig.plot3d( data=gdf, perspective=[315, 25], - region=[0, 10, 0, 10, 0, 10], - frame=[ - "wsnez3", - "xafg", - "yafg", - "zafg", - ], + region=[0, 2, 0, 2, 0, 2], + projection="X2c", + frame=["WsNeZ1", "xag", "yag", "zag"], zscale=1.5, ) return fig From b2204ad5a1a40d381c80500fc382eb63edecdd4f Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Fri, 6 Aug 2021 14:09:23 +0300 Subject: [PATCH 18/26] change the test figuers size to make smaller sizewd figuers --- .../tests/baseline/test_geopandas_plot3d_default_cube.png.dvc | 4 ++-- .../tests/baseline/test_geopandas_plot_default_square.png.dvc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pygmt/tests/baseline/test_geopandas_plot3d_default_cube.png.dvc b/pygmt/tests/baseline/test_geopandas_plot3d_default_cube.png.dvc index 3cfea24ebfa..9493b9b9ca1 100644 --- a/pygmt/tests/baseline/test_geopandas_plot3d_default_cube.png.dvc +++ b/pygmt/tests/baseline/test_geopandas_plot3d_default_cube.png.dvc @@ -1,4 +1,4 @@ outs: -- md5: 97329f92f899eaab2fc3b5dd7eac4a28 - size: 101975 +- md5: 48e8bd30372aa5ab9004c1fd53db7ab6 + size: 12132 path: test_geopandas_plot3d_default_cube.png diff --git a/pygmt/tests/baseline/test_geopandas_plot_default_square.png.dvc b/pygmt/tests/baseline/test_geopandas_plot_default_square.png.dvc index a0b9c4aef46..c52a04a4696 100644 --- a/pygmt/tests/baseline/test_geopandas_plot_default_square.png.dvc +++ b/pygmt/tests/baseline/test_geopandas_plot_default_square.png.dvc @@ -1,4 +1,4 @@ outs: -- md5: f38930acf3b735181a10277a3ffbfd3e - size: 11198 +- md5: 6c395fb503f67d024925a2c86cae7ba8 + size: 4272 path: test_geopandas_plot_default_square.png From 0b642a96ec823a2d5318b6d38e356cdd2d6f52f7 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Wed, 11 Aug 2021 18:37:48 +0300 Subject: [PATCH 19/26] adding test for non defualt style --- ...eopandas_plot3d_non_default_circle.png.dvc | 4 +++ ..._geopandas_plot_non_default_circle.png.dvc | 4 +++ pygmt/tests/test_geopandas.py | 33 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 pygmt/tests/baseline/test_geopandas_plot3d_non_default_circle.png.dvc create mode 100644 pygmt/tests/baseline/test_geopandas_plot_non_default_circle.png.dvc diff --git a/pygmt/tests/baseline/test_geopandas_plot3d_non_default_circle.png.dvc b/pygmt/tests/baseline/test_geopandas_plot3d_non_default_circle.png.dvc new file mode 100644 index 00000000000..58d7a3ba4fe --- /dev/null +++ b/pygmt/tests/baseline/test_geopandas_plot3d_non_default_circle.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 54cdcd316554c9db4d71cc2bea2a690a + size: 12028 + path: test_geopandas_plot3d_non_default_circle.png diff --git a/pygmt/tests/baseline/test_geopandas_plot_non_default_circle.png.dvc b/pygmt/tests/baseline/test_geopandas_plot_non_default_circle.png.dvc new file mode 100644 index 00000000000..d7316004d2a --- /dev/null +++ b/pygmt/tests/baseline/test_geopandas_plot_non_default_circle.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 4a946506f8a48be04792fdabffc6fa07 + size: 4451 + path: test_geopandas_plot_non_default_circle.png diff --git a/pygmt/tests/test_geopandas.py b/pygmt/tests/test_geopandas.py index 04ba53a8a7e..ff199a072d5 100644 --- a/pygmt/tests/test_geopandas.py +++ b/pygmt/tests/test_geopandas.py @@ -97,3 +97,36 @@ def test_geopandas_plot3d_default_cube(): zscale=1.5, ) return fig + +@pytest.mark.mpl_image_compare +def test_geopandas_plot_non_default_circle(): + """ + Check the default behavior of plotting geopandas DataFrame with Point + geometry in 2d. + """ + point = shapely.geometry.Point(1, 2) + gdf = gpd.GeoDataFrame(geometry=[point]) + fig = Figure() + fig.plot(data=gdf, region=[0, 2, 1, 3], projection="X2c", frame=True, style='c0.2c') + return fig + + +@pytest.mark.mpl_image_compare +def test_geopandas_plot3d_non_default_circle(): + """ + Check the default behavior of plotting geopandas DataFrame with MultiPoint + geometry in 3d. + """ + multipoint = shapely.geometry.MultiPoint([(0.5, 0.5, 0.5), (1.5, 1.5, 1.5)]) + gdf = gpd.GeoDataFrame(geometry=[multipoint]) + fig = Figure() + fig.plot3d( + data=gdf, + perspective=[315, 25], + region=[0, 2, 0, 2, 0, 2], + projection="X2c", + frame=["WsNeZ1", "xag", "yag", "zag"], + zscale=1.5, + style='c0.2c' + ) + return fig From 5d778f147d592e6005971c7e7766d1bf8ea40b6a Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Thu, 12 Aug 2021 07:58:57 +0300 Subject: [PATCH 20/26] adding a coment explaining the if statment --- pygmt/src/plot.py | 2 +- pygmt/src/plot3d.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index 777a877e053..092e9dff0b9 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -211,7 +211,7 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): "S" not in kwargs and kind == "geojson" and data.geom_type.isin(["Point", "MultiPoint"]).all() - ): + ):# chacking if the geometry of a geoDataFrame is Point or MultiPoint kwargs["S"] = "s0.2c" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": diff --git a/pygmt/src/plot3d.py b/pygmt/src/plot3d.py index cd4df7f3faa..ae02a4b76b6 100644 --- a/pygmt/src/plot3d.py +++ b/pygmt/src/plot3d.py @@ -181,7 +181,7 @@ def plot3d( "S" not in kwargs and kind == "geojson" and data.geom_type.isin(["Point", "MultiPoint"]).all() - ): + ):# chacking if the geometry of a geoDataFrame is Point or MultiPoint kwargs["S"] = "u0.2c" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": From e36b3eb52d2f9ca6f9de97fbbe919dabf0ff347c Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Thu, 12 Aug 2021 07:59:57 +0300 Subject: [PATCH 21/26] reformat --- pygmt/src/plot.py | 2 +- pygmt/src/plot3d.py | 2 +- pygmt/tests/test_geopandas.py | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index 092e9dff0b9..d98d4cfdb79 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -211,7 +211,7 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): "S" not in kwargs and kind == "geojson" and data.geom_type.isin(["Point", "MultiPoint"]).all() - ):# chacking if the geometry of a geoDataFrame is Point or MultiPoint + ): # chacking if the geometry of a geoDataFrame is Point or MultiPoint kwargs["S"] = "s0.2c" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": diff --git a/pygmt/src/plot3d.py b/pygmt/src/plot3d.py index ae02a4b76b6..15497c5799b 100644 --- a/pygmt/src/plot3d.py +++ b/pygmt/src/plot3d.py @@ -181,7 +181,7 @@ def plot3d( "S" not in kwargs and kind == "geojson" and data.geom_type.isin(["Point", "MultiPoint"]).all() - ):# chacking if the geometry of a geoDataFrame is Point or MultiPoint + ): # chacking if the geometry of a geoDataFrame is Point or MultiPoint kwargs["S"] = "u0.2c" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": diff --git a/pygmt/tests/test_geopandas.py b/pygmt/tests/test_geopandas.py index ff199a072d5..ac306a1860c 100644 --- a/pygmt/tests/test_geopandas.py +++ b/pygmt/tests/test_geopandas.py @@ -98,6 +98,7 @@ def test_geopandas_plot3d_default_cube(): ) return fig + @pytest.mark.mpl_image_compare def test_geopandas_plot_non_default_circle(): """ @@ -107,7 +108,7 @@ def test_geopandas_plot_non_default_circle(): point = shapely.geometry.Point(1, 2) gdf = gpd.GeoDataFrame(geometry=[point]) fig = Figure() - fig.plot(data=gdf, region=[0, 2, 1, 3], projection="X2c", frame=True, style='c0.2c') + fig.plot(data=gdf, region=[0, 2, 1, 3], projection="X2c", frame=True, style="c0.2c") return fig @@ -127,6 +128,6 @@ def test_geopandas_plot3d_non_default_circle(): projection="X2c", frame=["WsNeZ1", "xag", "yag", "zag"], zscale=1.5, - style='c0.2c' + style="c0.2c", ) return fig From 96b683c150c7e51b9942a2c5b681484131dd6e39 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Sat, 14 Aug 2021 16:42:27 +0300 Subject: [PATCH 22/26] Update pygmt/src/plot.py Co-authored-by: Dongdong Tian --- pygmt/src/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index d98d4cfdb79..31db1e25771 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -211,7 +211,7 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): "S" not in kwargs and kind == "geojson" and data.geom_type.isin(["Point", "MultiPoint"]).all() - ): # chacking if the geometry of a geoDataFrame is Point or MultiPoint + ): # checking if the geometry of a geoDataFrame is Point or MultiPoint kwargs["S"] = "s0.2c" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": From e57ec91634584db616f74d030f6ea30ab5a27778 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Sat, 14 Aug 2021 16:42:42 +0300 Subject: [PATCH 23/26] Update pygmt/src/plot3d.py Co-authored-by: Dongdong Tian --- pygmt/src/plot3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/plot3d.py b/pygmt/src/plot3d.py index 15497c5799b..84f229cdc92 100644 --- a/pygmt/src/plot3d.py +++ b/pygmt/src/plot3d.py @@ -181,7 +181,7 @@ def plot3d( "S" not in kwargs and kind == "geojson" and data.geom_type.isin(["Point", "MultiPoint"]).all() - ): # chacking if the geometry of a geoDataFrame is Point or MultiPoint + ): # checking if the geometry of a geoDataFrame is Point or MultiPoint kwargs["S"] = "u0.2c" if "G" in kwargs and not isinstance(kwargs["G"], str): if kind != "vectors": From 4d1339476f79bbcca4523b277bf2a8b82ae72ba2 Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Tue, 17 Aug 2021 08:06:41 +0300 Subject: [PATCH 24/26] Update pygmt/tests/test_geopandas.py Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com> --- pygmt/tests/test_geopandas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/tests/test_geopandas.py b/pygmt/tests/test_geopandas.py index ac306a1860c..860b348a3b4 100644 --- a/pygmt/tests/test_geopandas.py +++ b/pygmt/tests/test_geopandas.py @@ -69,7 +69,7 @@ def test_geopandas_info_shapely(gdf, geomtype, desired): @pytest.mark.mpl_image_compare def test_geopandas_plot_default_square(): """ - Check the default behavior of plotting geopandas DataFrame with Point + Check the default behavior of plotting a geopandas DataFrame with Point geometry in 2d. """ point = shapely.geometry.Point(1, 2) From b7827e0e57e4ef581625f1a915a63a6a054f51bb Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Tue, 17 Aug 2021 08:06:56 +0300 Subject: [PATCH 25/26] Update pygmt/tests/test_geopandas.py Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com> --- pygmt/tests/test_geopandas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/tests/test_geopandas.py b/pygmt/tests/test_geopandas.py index 860b348a3b4..1f471f8ad96 100644 --- a/pygmt/tests/test_geopandas.py +++ b/pygmt/tests/test_geopandas.py @@ -82,7 +82,7 @@ def test_geopandas_plot_default_square(): @pytest.mark.mpl_image_compare def test_geopandas_plot3d_default_cube(): """ - Check the default behavior of plotting geopandas DataFrame with MultiPoint + Check the default behavior of plotting a geopandas DataFrame with MultiPoint geometry in 3d. """ multipoint = shapely.geometry.MultiPoint([(0.5, 0.5, 0.5), (1.5, 1.5, 1.5)]) From d62608cd29f217c11c498a400db6ed0ee4ef536e Mon Sep 17 00:00:00 2001 From: yohaimagen Date: Tue, 17 Aug 2021 08:31:19 +0300 Subject: [PATCH 26/26] reformat --- pygmt/tests/test_geopandas.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/tests/test_geopandas.py b/pygmt/tests/test_geopandas.py index 1f471f8ad96..575670cf123 100644 --- a/pygmt/tests/test_geopandas.py +++ b/pygmt/tests/test_geopandas.py @@ -82,8 +82,8 @@ def test_geopandas_plot_default_square(): @pytest.mark.mpl_image_compare def test_geopandas_plot3d_default_cube(): """ - Check the default behavior of plotting a geopandas DataFrame with MultiPoint - geometry in 3d. + Check the default behavior of plotting a geopandas DataFrame with + MultiPoint geometry in 3d. """ multipoint = shapely.geometry.MultiPoint([(0.5, 0.5, 0.5), (1.5, 1.5, 1.5)]) gdf = gpd.GeoDataFrame(geometry=[multipoint])