From c042b0a39820a6bdcf4dedc96381b1387df0e42d Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Mar 2021 21:44:05 +0000 Subject: [PATCH 01/25] Add histogram.py --- pygmt/figure.py | 1 + pygmt/src/__init__.py | 1 + pygmt/src/histogram.py | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 pygmt/src/histogram.py diff --git a/pygmt/figure.py b/pygmt/figure.py index acd448b9472..e1fc416c572 100644 --- a/pygmt/figure.py +++ b/pygmt/figure.py @@ -383,6 +383,7 @@ def _repr_html_(self): grdcontour, grdimage, grdview, + histogram, image, inset, legend, diff --git a/pygmt/src/__init__.py b/pygmt/src/__init__.py index 2e080c71448..63d72aa17ac 100644 --- a/pygmt/src/__init__.py +++ b/pygmt/src/__init__.py @@ -15,6 +15,7 @@ from pygmt.src.grdinfo import grdinfo from pygmt.src.grdtrack import grdtrack from pygmt.src.grdview import grdview +from pygmt.src.histogram import histogram from pygmt.src.image import image from pygmt.src.info import info from pygmt.src.inset import inset diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py new file mode 100644 index 00000000000..9d66f4edb60 --- /dev/null +++ b/pygmt/src/histogram.py @@ -0,0 +1,34 @@ +""" +Histogram - Create a histogram +""" +from pygmt.clib import Session +from pygmt.helpers import ( + GMTTempFile, + build_arg_string, + fmt_docstring, + kwargs_to_strings, + use_alias, +) + + +@fmt_docstring +@use_alias( + J="projection", + G="color", + R="region", +) +@kwargs_to_strings(R="sequence") +def histogram(table, **kwargs): + r""" + Histogram + """ + with GMTTempFile() as outfile: + with Session() as lib: + file_context = lib.virtualfile_from_data(data=table) + with file_context as infile: + arg_str = " ".join( + [infile, build_arg_string(kwargs), "->" + outfile.name] + ) + lib.call_module("histogram", arg_str) + result = outfile.read() + return result From 4409760858799d7ae3f7104548ecf8a605d6c4b4 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Mar 2021 21:50:09 +0000 Subject: [PATCH 02/25] remove outfile name --- pygmt/src/histogram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 9d66f4edb60..05c70bcee4f 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -27,7 +27,7 @@ def histogram(table, **kwargs): file_context = lib.virtualfile_from_data(data=table) with file_context as infile: arg_str = " ".join( - [infile, build_arg_string(kwargs), "->" + outfile.name] + [infile, build_arg_string(kwargs)] ) lib.call_module("histogram", arg_str) result = outfile.read() From fe086b3a6dbe06e331f44546fe1bedfec90be25c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Mar 2021 23:02:04 +0000 Subject: [PATCH 03/25] Update pygmt/src/histogram.py Co-authored-by: Dongdong Tian --- pygmt/src/histogram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 05c70bcee4f..168c89a9f7b 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -18,7 +18,7 @@ R="region", ) @kwargs_to_strings(R="sequence") -def histogram(table, **kwargs): +def histogram(self, table, **kwargs): r""" Histogram """ From da2539f4605939783c32eaedfc2aff28435e38c0 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 18 Mar 2021 19:02:07 +0000 Subject: [PATCH 04/25] wrap additional arguments --- pygmt/src/histogram.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 168c89a9f7b..5b3bebc8573 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -13,11 +13,29 @@ @fmt_docstring @use_alias( + A="horizontal", + B="frame", + C="cmap", + D="annotation", + F="center", + G="fill", J="projection", - G="color", + JZ="zscale", + L="extreme_values", + N="normal_dist", + Qr="cumulative", R="region", + S="stairs", + T="interval", + U="logo", + V="verbose", + W="pen", + X="xshift", + Y="yshift", + Z="type", + p="perspective" ) -@kwargs_to_strings(R="sequence") +@kwargs_to_strings(R="sequence", T="sequence") def histogram(self, table, **kwargs): r""" Histogram From f1cbad212cdc595d6e154aa8a05c415a944c5a23 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 18 Mar 2021 19:18:56 +0000 Subject: [PATCH 05/25] run make format --- pygmt/src/histogram.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 5b3bebc8573..7d826714f58 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -33,7 +33,7 @@ X="xshift", Y="yshift", Z="type", - p="perspective" + p="perspective", ) @kwargs_to_strings(R="sequence", T="sequence") def histogram(self, table, **kwargs): @@ -44,9 +44,7 @@ def histogram(self, table, **kwargs): with Session() as lib: file_context = lib.virtualfile_from_data(data=table) with file_context as infile: - arg_str = " ".join( - [infile, build_arg_string(kwargs)] - ) + arg_str = " ".join([infile, build_arg_string(kwargs)]) lib.call_module("histogram", arg_str) result = outfile.read() return result From 1e0e9aa6d40267e078f151b95dc50a3851a36923 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 5 Apr 2021 15:58:45 +0100 Subject: [PATCH 06/25] add into of docstring for histogram.py --- pygmt/src/histogram.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 7d826714f58..c4f79fcbe5b 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -38,7 +38,11 @@ @kwargs_to_strings(R="sequence", T="sequence") def histogram(self, table, **kwargs): r""" - Histogram + Plots a histogram, and can read data from a file or list, array, or dataframe. + + Full option list at :gmt-docs:`histogram.html` + + {aliases} """ with GMTTempFile() as outfile: with Session() as lib: From 6ec0a66521d0ac992007359ebdd90c060b3397c6 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 5 Apr 2021 16:01:09 +0100 Subject: [PATCH 07/25] add histogram to index.rst --- doc/api/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/api/index.rst b/doc/api/index.rst index 3b4220b7e7d..80fe3dd7615 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -29,6 +29,7 @@ Plotting data and laying out the map: Figure.grdcontour Figure.grdimage Figure.grdview + Figure.histogram Figure.image Figure.inset Figure.legend From fb2b4ce0c81b82a856b4f727d2d627bf272d60ef Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 6 Apr 2021 20:12:41 +0100 Subject: [PATCH 08/25] add histogram aliases to docstring --- pygmt/src/histogram.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index c4f79fcbe5b..36492fb7897 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -38,11 +38,20 @@ @kwargs_to_strings(R="sequence", T="sequence") def histogram(self, table, **kwargs): r""" - Plots a histogram, and can read data from a file or list, array, or dataframe. + Plots a histogram, and can read data from a file or + list, array, or dataframe. Full option list at :gmt-docs:`histogram.html` {aliases} + + Parameters + ---------- + table : str, list, or 1d array + A data file name, list, or 1d numpy array. This is a required argument. + {J} + {R} + {B} """ with GMTTempFile() as outfile: with Session() as lib: From 8899a489527390bbd5270e46d41f89534fb1a07b Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 8 Apr 2021 07:03:25 +0100 Subject: [PATCH 09/25] remove uncommon parameters --- pygmt/src/histogram.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 36492fb7897..b9ffa377348 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -16,23 +16,10 @@ A="horizontal", B="frame", C="cmap", - D="annotation", - F="center", G="fill", J="projection", - JZ="zscale", - L="extreme_values", - N="normal_dist", - Qr="cumulative", R="region", - S="stairs", - T="interval", - U="logo", - V="verbose", W="pen", - X="xshift", - Y="yshift", - Z="type", p="perspective", ) @kwargs_to_strings(R="sequence", T="sequence") From d30037cd97b11262480827ec2a045bae222936eb Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 8 Apr 2021 07:10:11 +0100 Subject: [PATCH 10/25] update docstring for histogram --- pygmt/src/histogram.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index b9ffa377348..258c9838ca7 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -39,6 +39,13 @@ def histogram(self, table, **kwargs): {J} {R} {B} + {CPT} + {G} + {W} + {p} + horizontal : bool + Plot the histogram using horizonal bars instead of the + default vertical bars. """ with GMTTempFile() as outfile: with Session() as lib: From b8040ab4b4a658f5312e03703aa09a247011354d Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 8 Apr 2021 07:18:35 +0100 Subject: [PATCH 11/25] add interval --- pygmt/src/histogram.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 258c9838ca7..1da75117017 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -19,6 +19,7 @@ G="fill", J="projection", R="region", + T="interval", W="pen", p="perspective", ) @@ -46,6 +47,9 @@ def histogram(self, table, **kwargs): horizontal : bool Plot the histogram using horizonal bars instead of the default vertical bars. + interval : int or str + [*min*\ /*max*\ /]\ *inc*\ [**+n**\ ] + Set the interval for the width of each bar in the histogram. """ with GMTTempFile() as outfile: with Session() as lib: From 2439d6a8795d2282ec00d1538f7c2de7db6bcb2e Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 8 Apr 2021 07:27:46 +0100 Subject: [PATCH 12/25] Add test_histogram.py --- pygmt/tests/test_histogram.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pygmt/tests/test_histogram.py diff --git a/pygmt/tests/test_histogram.py b/pygmt/tests/test_histogram.py new file mode 100644 index 00000000000..faa983565eb --- /dev/null +++ b/pygmt/tests/test_histogram.py @@ -0,0 +1,19 @@ +# pylint: disable=redefined-outer-name +""" +Tests histogram. +""" +import numpy as np +import pytest +from pygmt import Figure + + + +@pytest.fixture(scope="module") +def table(): + return [1,1,1,1,1,1,2,2,2,3,4,5,6,7,8,8,8,8,8,8] + +@pytest.mark.mpl_image_compare +def test_histogram(table): + fig = Figure() + fig.histogram(table=table, projection="X10c/25c", interval=1, frame="a", fill="green") + return fig \ No newline at end of file From 05c005f590057e801692f638076212151aaf38f7 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 8 Apr 2021 07:29:10 +0100 Subject: [PATCH 13/25] add test_histogram.png.dvc --- pygmt/tests/baseline/test_histogram.png.dvc | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 pygmt/tests/baseline/test_histogram.png.dvc diff --git a/pygmt/tests/baseline/test_histogram.png.dvc b/pygmt/tests/baseline/test_histogram.png.dvc new file mode 100644 index 00000000000..0c60c32ab62 --- /dev/null +++ b/pygmt/tests/baseline/test_histogram.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: d11fec1232c5be477f3e51e4019a2d0e + size: 26172 + path: test_histogram.png From 34af05f2d5eecbf4a8fb1b0c83073d3cc2b595ca Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 8 Apr 2021 07:30:18 +0100 Subject: [PATCH 14/25] run make format --- pygmt/tests/test_histogram.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pygmt/tests/test_histogram.py b/pygmt/tests/test_histogram.py index faa983565eb..70ef4e1d149 100644 --- a/pygmt/tests/test_histogram.py +++ b/pygmt/tests/test_histogram.py @@ -7,13 +7,15 @@ from pygmt import Figure - @pytest.fixture(scope="module") def table(): - return [1,1,1,1,1,1,2,2,2,3,4,5,6,7,8,8,8,8,8,8] + return [1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8] + @pytest.mark.mpl_image_compare def test_histogram(table): fig = Figure() - fig.histogram(table=table, projection="X10c/25c", interval=1, frame="a", fill="green") - return fig \ No newline at end of file + fig.histogram( + table=table, projection="X10c/25c", interval=1, frame="a", fill="green" + ) + return fig From 1cfac3560746b4f5f25b017da56dd7869e5e599d Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 9 Apr 2021 07:00:43 +0100 Subject: [PATCH 15/25] add line breaks --- pygmt/src/histogram.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 1da75117017..709c316917a 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -35,6 +35,7 @@ def histogram(self, table, **kwargs): Parameters ---------- + table : str, list, or 1d array A data file name, list, or 1d numpy array. This is a required argument. {J} @@ -50,6 +51,7 @@ def histogram(self, table, **kwargs): interval : int or str [*min*\ /*max*\ /]\ *inc*\ [**+n**\ ] Set the interval for the width of each bar in the histogram. + """ with GMTTempFile() as outfile: with Session() as lib: From 72c022c62c80f31e9b514ebe19b8a4b66fd6e375 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 9 Apr 2021 07:01:49 +0100 Subject: [PATCH 16/25] add docstrings to test_histogram.py --- pygmt/tests/test_histogram.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pygmt/tests/test_histogram.py b/pygmt/tests/test_histogram.py index 70ef4e1d149..822b29c0e91 100644 --- a/pygmt/tests/test_histogram.py +++ b/pygmt/tests/test_histogram.py @@ -2,18 +2,23 @@ """ Tests histogram. """ -import numpy as np import pytest from pygmt import Figure @pytest.fixture(scope="module") def table(): + """ + Returns a list of integers to be used in the histogram. + """ return [1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8] @pytest.mark.mpl_image_compare def test_histogram(table): + """ + Tests plotting a histogram using a list of integers. + """ fig = Figure() fig.histogram( table=table, projection="X10c/25c", interval=1, frame="a", fill="green" From b5cf33970e8ffc8d847e4e2ba799a66a599e7bfa Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 12 Apr 2021 15:31:47 +0100 Subject: [PATCH 17/25] Apply suggestions from code review Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/src/histogram.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 709c316917a..6141955a2eb 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -19,8 +19,10 @@ G="fill", J="projection", R="region", - T="interval", + T="series", W="pen", + c="panel", + l="label", p="perspective", ) @kwargs_to_strings(R="sequence", T="sequence") @@ -44,6 +46,9 @@ def histogram(self, table, **kwargs): {CPT} {G} {W} + {c} + label : str + Add a legend entry for the symbol or line being plotted. {p} horizontal : bool Plot the histogram using horizonal bars instead of the @@ -53,9 +58,10 @@ def histogram(self, table, **kwargs): Set the interval for the width of each bar in the histogram. """ + kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access with GMTTempFile() as outfile: with Session() as lib: - file_context = lib.virtualfile_from_data(data=table) + file_context = lib.virtualfile_from_data(check_kind="vector", data=table) with file_context as infile: arg_str = " ".join([infile, build_arg_string(kwargs)]) lib.call_module("histogram", arg_str) From d9b8e39ceba4bc6c9b92ecc11cf9ff4582d920d9 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 12 Apr 2021 18:26:12 +0100 Subject: [PATCH 18/25] remove GMTTempFile --- pygmt/src/histogram.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 6141955a2eb..d4bdf2ca90d 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -2,13 +2,7 @@ Histogram - Create a histogram """ from pygmt.clib import Session -from pygmt.helpers import ( - GMTTempFile, - build_arg_string, - fmt_docstring, - kwargs_to_strings, - use_alias, -) +from pygmt.helpers import build_arg_string, fmt_docstring, kwargs_to_strings, use_alias @fmt_docstring @@ -59,11 +53,8 @@ def histogram(self, table, **kwargs): """ kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access - with GMTTempFile() as outfile: - with Session() as lib: - file_context = lib.virtualfile_from_data(check_kind="vector", data=table) - with file_context as infile: - arg_str = " ".join([infile, build_arg_string(kwargs)]) - lib.call_module("histogram", arg_str) - result = outfile.read() - return result + with Session() as lib: + file_context = lib.virtualfile_from_data(check_kind="vector", data=table) + with file_context as infile: + arg_str = " ".join([infile, build_arg_string(kwargs)]) + lib.call_module("histogram", arg_str) From 69f5d4d09468a3d1a83453493c89fd4ed81f117b Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 24 Apr 2021 07:04:14 +0100 Subject: [PATCH 19/25] Update pygmt/src/histogram.py Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/src/histogram.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index d4bdf2ca90d..4f00da7ba51 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -31,7 +31,6 @@ def histogram(self, table, **kwargs): Parameters ---------- - table : str, list, or 1d array A data file name, list, or 1d numpy array. This is a required argument. {J} From 55c3fbc066c7d83907194583ffd33bc7c4ad8d22 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 24 Apr 2021 07:50:44 +0100 Subject: [PATCH 20/25] update interval parameter to series in test_histogram() in test_histogram.py --- pygmt/tests/test_histogram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/tests/test_histogram.py b/pygmt/tests/test_histogram.py index 822b29c0e91..0b31d0c1c41 100644 --- a/pygmt/tests/test_histogram.py +++ b/pygmt/tests/test_histogram.py @@ -21,6 +21,6 @@ def test_histogram(table): """ fig = Figure() fig.histogram( - table=table, projection="X10c/25c", interval=1, frame="a", fill="green" + table=table, projection="X10c/25c", series=1, frame="a", fill="green" ) return fig From 1d86dc79c7fd6abcc9cd7dd931a0624cd6b0f380 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 24 Apr 2021 07:51:54 +0100 Subject: [PATCH 21/25] update test_histogram.png.dvc --- pygmt/tests/baseline/test_histogram.png.dvc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/tests/baseline/test_histogram.png.dvc b/pygmt/tests/baseline/test_histogram.png.dvc index 0c60c32ab62..c350bcf65fe 100644 --- a/pygmt/tests/baseline/test_histogram.png.dvc +++ b/pygmt/tests/baseline/test_histogram.png.dvc @@ -1,4 +1,4 @@ outs: -- md5: d11fec1232c5be477f3e51e4019a2d0e - size: 26172 +- md5: 314634815787d56a557f9646dcba7526 + size: 21674 path: test_histogram.png From c914954f83c7c8ca9c5ab64867c76650171747c1 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 24 Apr 2021 07:52:23 +0100 Subject: [PATCH 22/25] run make format --- pygmt/tests/test_histogram.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pygmt/tests/test_histogram.py b/pygmt/tests/test_histogram.py index 0b31d0c1c41..a6f1d6512a7 100644 --- a/pygmt/tests/test_histogram.py +++ b/pygmt/tests/test_histogram.py @@ -20,7 +20,5 @@ def test_histogram(table): Tests plotting a histogram using a list of integers. """ fig = Figure() - fig.histogram( - table=table, projection="X10c/25c", series=1, frame="a", fill="green" - ) + fig.histogram(table=table, projection="X10c/25c", series=1, frame="a", fill="green") return fig From cb9e25ec759a0b625be9efaeae40506db1dbce10 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 24 Apr 2021 13:21:35 +0100 Subject: [PATCH 23/25] Update pygmt/src/histogram.py Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/src/histogram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 4f00da7ba51..3759a27061e 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -46,7 +46,7 @@ def histogram(self, table, **kwargs): horizontal : bool Plot the histogram using horizonal bars instead of the default vertical bars. - interval : int or str + series : int or str or list [*min*\ /*max*\ /]\ *inc*\ [**+n**\ ] Set the interval for the width of each bar in the histogram. From 85201e5c7deb3aa39824cdebcab8f3ff7e8bad85 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 26 Apr 2021 16:56:49 +0100 Subject: [PATCH 24/25] add region argument in test_histogram() in test_histogram.py --- pygmt/tests/test_histogram.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pygmt/tests/test_histogram.py b/pygmt/tests/test_histogram.py index a6f1d6512a7..77dd5f03807 100644 --- a/pygmt/tests/test_histogram.py +++ b/pygmt/tests/test_histogram.py @@ -20,5 +20,12 @@ def test_histogram(table): Tests plotting a histogram using a list of integers. """ fig = Figure() - fig.histogram(table=table, projection="X10c/25c", series=1, frame="a", fill="green") + fig.histogram( + table=table, + projection="X10c/10c", + region=[0, 9, 0, 6], + series=1, + frame="a", + fill="green", + ) return fig From 9980315f230949cd83e565d615938e881b76cdb8 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 26 Apr 2021 17:03:24 +0100 Subject: [PATCH 25/25] update test_histogram.png.dvc --- pygmt/tests/baseline/test_histogram.png.dvc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/tests/baseline/test_histogram.png.dvc b/pygmt/tests/baseline/test_histogram.png.dvc index c350bcf65fe..33b740d0fb4 100644 --- a/pygmt/tests/baseline/test_histogram.png.dvc +++ b/pygmt/tests/baseline/test_histogram.png.dvc @@ -1,4 +1,4 @@ outs: -- md5: 314634815787d56a557f9646dcba7526 - size: 21674 +- md5: 8499f1d0ef232ece53300c6aaf611607 + size: 10794 path: test_histogram.png