From 8105d33f0383aea76899ec7fc19b91c38fc9c49c Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 30 Jun 2026 17:30:42 +0800 Subject: [PATCH 1/4] Figure.ternary: Migrate the 'width' parameter to the new alias system --- pygmt/src/ternary.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pygmt/src/ternary.py b/pygmt/src/ternary.py index 23e75109689..7a289467fdb 100644 --- a/pygmt/src/ternary.py +++ b/pygmt/src/ternary.py @@ -108,10 +108,11 @@ def _ternary_frame(frame): @fmt_docstring -@use_alias(C="cmap", G="fill", JX="width", S="style", W="pen") +@use_alias(C="cmap", G="fill", S="style", W="pen") def ternary( # noqa: PLR0913 self, data: PathLike | TableLike, + width: float | str | None = None, alabel: str | None = None, blabel: str | None = None, clabel: str | None = None, @@ -139,6 +140,7 @@ def ternary( # noqa: PLR0913 $aliases - B = frame + - JX = width - L = alabel/blabel/clabel - R = region - V = verbose @@ -151,12 +153,10 @@ def ternary( # noqa: PLR0913 data Pass in either a file name to an ASCII data table, a Python list, a 2-D $table_classes. - width : str - Set the width of the figure by passing a number, followed by - a unit (**i** for inches, **c** for centimeters). Use a negative width - to indicate that positive axes directions be clock-wise - [Default lets the a, b, c axes be positive in a - counter-clockwise direction]. + width + Width of the ternary diagram. Use a negative width to indicate that positive + axes directions be clock-wise [Default lets the **a**, **b**, **c** axes be + positive in a counter-clockwise direction]. region : str or list [*amin*, *amax*, *bmin*, *bmax*, *cmin*, *cmax*]. Give the min and max limits for each of the three axes **a**, **b**, @@ -189,6 +189,7 @@ def ternary( # noqa: PLR0913 labels = _labels if any(v != "-" for v in _labels) else None aliasdict = AliasSystem( + JX=Alias(width, name="width"), L=Alias(labels, name="alabel/blabel/clabel", sep="/", size=3), ).add_common( B=_ternary_frame(frame), From af91dd7b51c3564de0c0b12cc1d4f4f291d6ac47 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 30 Jun 2026 17:37:06 +0800 Subject: [PATCH 2/4] Figure.ternary: Add the 'no_clip' parameter for option -N --- pygmt/src/ternary.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pygmt/src/ternary.py b/pygmt/src/ternary.py index 7a289467fdb..aea4a2ad2d5 100644 --- a/pygmt/src/ternary.py +++ b/pygmt/src/ternary.py @@ -116,6 +116,7 @@ def ternary( # noqa: PLR0913 alabel: str | None = None, blabel: str | None = None, clabel: str | None = None, + no_clip: bool = False, region: Sequence[float | str] | str | None = None, frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False, verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] @@ -142,6 +143,7 @@ def ternary( # noqa: PLR0913 - B = frame - JX = width - L = alabel/blabel/clabel + - N = no_clip - R = region - V = verbose - c = panel @@ -178,6 +180,9 @@ def ternary( # noqa: PLR0913 *symbol*\[\ *size*]. Plot individual symbols in a ternary diagram. $pen + no_clip + Do not clip symbols to the ternary diagram [Default plot points whose + coordinates are strictly inside the map border]. $verbose $panel $perspective @@ -191,6 +196,7 @@ def ternary( # noqa: PLR0913 aliasdict = AliasSystem( JX=Alias(width, name="width"), L=Alias(labels, name="alabel/blabel/clabel", sep="/", size=3), + N=Alias(no_clip, name="no_clip"), ).add_common( B=_ternary_frame(frame), R=region, From ebf5813eae8cb6902a3ea7fe550d1e890436b067 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 30 Jun 2026 17:43:25 +0800 Subject: [PATCH 3/4] Figure.ternary: Migrate pen and fill to the new alias system --- pygmt/src/ternary.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pygmt/src/ternary.py b/pygmt/src/ternary.py index aea4a2ad2d5..7733b9870c2 100644 --- a/pygmt/src/ternary.py +++ b/pygmt/src/ternary.py @@ -108,11 +108,13 @@ def _ternary_frame(frame): @fmt_docstring -@use_alias(C="cmap", G="fill", S="style", W="pen") +@use_alias(C="cmap", S="style") def ternary( # noqa: PLR0913 self, data: PathLike | TableLike, + fill: str | None = None, width: float | str | None = None, + pen: str | None = None, alabel: str | None = None, blabel: str | None = None, clabel: str | None = None, @@ -141,11 +143,13 @@ def ternary( # noqa: PLR0913 $aliases - B = frame + - G = fill - JX = width - L = alabel/blabel/clabel - N = no_clip - R = region - V = verbose + - W = pen - c = panel - p = perspective - t = transparency @@ -167,7 +171,6 @@ def ternary( # noqa: PLR0913 For ternary diagrams, use :class:`pygmt.params.Frame` ``xaxis``, ``yaxis``, and ``zaxis`` attributes to set the **a**, **b**, and **c** axes, respectively. $cmap - $fill alabel Set the label for the *a* vertex where the component is 100%. The label is placed at a distance of three times the :gmt-term:`MAP_LABEL_OFFSET` setting @@ -179,7 +182,10 @@ def ternary( # noqa: PLR0913 style : str *symbol*\[\ *size*]. Plot individual symbols in a ternary diagram. - $pen + pen + Set pen attributes for the outlines of symbols. + fill + Set color or pattern for filling of symbols [Default is no fill]. no_clip Do not clip symbols to the ternary diagram [Default plot points whose coordinates are strictly inside the map border]. @@ -194,9 +200,11 @@ def ternary( # noqa: PLR0913 labels = _labels if any(v != "-" for v in _labels) else None aliasdict = AliasSystem( + G=Alias(fill, name="fill"), JX=Alias(width, name="width"), L=Alias(labels, name="alabel/blabel/clabel", sep="/", size=3), N=Alias(no_clip, name="no_clip"), + W=Alias(pen, name="pen"), ).add_common( B=_ternary_frame(frame), R=region, From 4569ef184a3a9ab0fee3937e9ada93a3bb18d8cf Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 30 Jun 2026 17:58:25 +0800 Subject: [PATCH 4/4] Fix docstrings for pen --- pygmt/src/ternary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/ternary.py b/pygmt/src/ternary.py index 7733b9870c2..ce511562967 100644 --- a/pygmt/src/ternary.py +++ b/pygmt/src/ternary.py @@ -183,7 +183,7 @@ def ternary( # noqa: PLR0913 *symbol*\[\ *size*]. Plot individual symbols in a ternary diagram. pen - Set pen attributes for the outlines of symbols. + Set pen attributes for the outlines of symbols or lines. fill Set color or pattern for filling of symbols [Default is no fill]. no_clip