From 123a5e9bbab1bd00e0b34ae3fbff6468480a5433 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sat, 26 Feb 2022 19:24:18 +0800 Subject: [PATCH] Add a test to make sure the incols parameter works for pandas.DataFrame --- .../baseline/test_plot_dataframe_incols.png.dvc | 4 ++++ pygmt/tests/test_plot.py | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 pygmt/tests/baseline/test_plot_dataframe_incols.png.dvc diff --git a/pygmt/tests/baseline/test_plot_dataframe_incols.png.dvc b/pygmt/tests/baseline/test_plot_dataframe_incols.png.dvc new file mode 100644 index 00000000000..766439f7c40 --- /dev/null +++ b/pygmt/tests/baseline/test_plot_dataframe_incols.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: bad6889287951b3c888032af6b1fa945 + size: 7674 + path: test_plot_dataframe_incols.png diff --git a/pygmt/tests/test_plot.py b/pygmt/tests/test_plot.py index f3e1e24941a..fb46a872c0b 100644 --- a/pygmt/tests/test_plot.py +++ b/pygmt/tests/test_plot.py @@ -540,3 +540,18 @@ def test_plot_ogrgmt_file_multipoint_non_default_style(): style="c0.2c", ) return fig + + +@pytest.mark.mpl_image_compare +def test_plot_dataframe_incols(): + """ + Make sure that the incols parameter works for pandas.DataFrame. + + See https://github.com/GenericMappingTools/pygmt/issues/1440. + """ + data = pd.DataFrame(data={"col1": [-0.5, 0, 0.5], "col2": [-0.75, 0, 0.75]}) + fig = Figure() + fig.plot( + data=data, frame=True, region=[-1, 1, -1, 1], projection="X5c", incols=[1, 0] + ) + return fig