From e9e44f71209778326b7b313704ac9a323ef4be7b Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 4 Sep 2026 18:31:05 +0800 Subject: [PATCH 1/3] Figure.histogram: Let parameter 'cumulative' support readable arguments --- pygmt/src/histogram.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index 2141eab7ffd..d8ce2f5b14d 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -25,7 +25,6 @@ F="center", L="extreme", N="distribution", - Q="cumulative", S="stairs", T="series", Z="histtype", @@ -45,6 +44,7 @@ def histogram( cmap: str | bool = False, pen: str | None = None, fill: str | None = None, + cumulative: bool | Literal["reverse"] = False, projection: str | None = None, region: Sequence[float | str] | str | None = None, frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False, @@ -67,6 +67,7 @@ def histogram( - E = bar_width, **+o**: bar_offset - G = fill - J = projection + - Q = cumulative - R = region - V = verbose - W = pen @@ -112,10 +113,9 @@ def histogram( * 0 = mean and standard deviation [Default]; * 1 = median and L1 scale (1.4826 \* median absolute deviation; MAD); * 2 = LMS (least median of squares) mode and scale. - cumulative : bool or str - [**r**]. - Draw a cumulative histogram by passing ``True``. Use **r** to display - a reverse cumulative histogram. + cumulative + Draw a cumulative histogram. Setting it to ``"reversed"`` to compute the + reversed cumulative histogram instead. extreme : str **l**\|\ **h**\|\ **b**. The modifiers specify the handling of extreme values that fall outside @@ -174,6 +174,7 @@ def histogram( Alias(bar_offset, name="bar_offset", prefix="+o"), ], G=Alias(fill, name="fill"), + Q=Alias(cumulative, name="cumalative", mapping={"reversed": "r"}), W=Alias(pen, name="pen"), ).add_common( B=frame, From e29c0b2d6dc40fc7204c193e2ce1edf2f1d558a1 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sat, 5 Sep 2026 00:45:18 +0800 Subject: [PATCH 2/3] Fix typos --- pygmt/src/histogram.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pygmt/src/histogram.py b/pygmt/src/histogram.py index d8ce2f5b14d..d5bdadf79f5 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -114,8 +114,8 @@ def histogram( * 1 = median and L1 scale (1.4826 \* median absolute deviation; MAD); * 2 = LMS (least median of squares) mode and scale. cumulative - Draw a cumulative histogram. Setting it to ``"reversed"`` to compute the - reversed cumulative histogram instead. + Draw a cumulative histogram. Set it to ``"reverse"`` to compute the reverse + cumulative histogram instead. extreme : str **l**\|\ **h**\|\ **b**. The modifiers specify the handling of extreme values that fall outside @@ -174,7 +174,7 @@ def histogram( Alias(bar_offset, name="bar_offset", prefix="+o"), ], G=Alias(fill, name="fill"), - Q=Alias(cumulative, name="cumalative", mapping={"reversed": "r"}), + Q=Alias(cumulative, name="cumulative", mapping={"reverse": "r"}), W=Alias(pen, name="pen"), ).add_common( B=frame, From 8f6b4b98bced324da0f9ac0418fdc2cfe712dc83 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sat, 5 Sep 2026 00:50:33 +0800 Subject: [PATCH 3/3] Polish docstring --- 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 d5bdadf79f5..793726b0468 100644 --- a/pygmt/src/histogram.py +++ b/pygmt/src/histogram.py @@ -114,7 +114,7 @@ def histogram( * 1 = median and L1 scale (1.4826 \* median absolute deviation; MAD); * 2 = LMS (least median of squares) mode and scale. cumulative - Draw a cumulative histogram. Set it to ``"reverse"`` to compute the reverse + Draw a cumulative histogram. Set it to ``"reverse"`` to draw the reverse cumulative histogram instead. extreme : str **l**\|\ **h**\|\ **b**.