From 1de3ab6e602c883fc5054206f60e7f4c38e7dd03 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 16 Dec 2025 09:49:23 +0100 Subject: [PATCH 1/4] Update colorbar.py --- pygmt/src/colorbar.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pygmt/src/colorbar.py b/pygmt/src/colorbar.py index 3e7efb32984..fcd45811da9 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -91,10 +91,17 @@ def colorbar( # noqa: PLR0913 ``region`` and ``projection`` to be specified. Append **+w** followed by the length and width of the colorbar. If width is not specified then it is set to 4% of the given length. Give a negative length to - reverse the scale bar. Append **+h** to get a horizontal scale - [Default is vertical (**+v**)]. By default, the anchor point on the - scale is assumed to be the bottom left corner (**BL**), but this can - be changed by appending **+j** followed by a + reverse the scale bar. Append **+e** to add sidebar triangles for + back- and/or foreground colors. Append **f** (foreground) or **b** + (background) for only one sidebar triangle [Default gives both]. + Optionally, append triangle *length* [Default is half the barwidth]. + The back and/or foreground colors are taken from your B and F colors + in your CPT. If none then the system default colors for B and F are + used instead (:gmt-term:`COLOR_BACKGROUND` and + :gmt-term:`COLOR_FOREGROUND`). Append **+h** to get a horizontal + scale [Default is vertical (**+v**)]. By default, the anchor point on + the scale is assumed to be the bottom left corner (**BL**), but this + can be changed by appending **+j** followed by a :doc:`2-character justification code ` *justify*. box From d80fa76319111b025f8a68ac835cb1eea6f8d5af Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 16 Dec 2025 09:53:55 +0100 Subject: [PATCH 2/4] rm tw --- pygmt/src/colorbar.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pygmt/src/colorbar.py b/pygmt/src/colorbar.py index fcd45811da9..74ec2025b4f 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -91,16 +91,16 @@ def colorbar( # noqa: PLR0913 ``region`` and ``projection`` to be specified. Append **+w** followed by the length and width of the colorbar. If width is not specified then it is set to 4% of the given length. Give a negative length to - reverse the scale bar. Append **+e** to add sidebar triangles for - back- and/or foreground colors. Append **f** (foreground) or **b** - (background) for only one sidebar triangle [Default gives both]. - Optionally, append triangle *length* [Default is half the barwidth]. - The back and/or foreground colors are taken from your B and F colors - in your CPT. If none then the system default colors for B and F are - used instead (:gmt-term:`COLOR_BACKGROUND` and - :gmt-term:`COLOR_FOREGROUND`). Append **+h** to get a horizontal - scale [Default is vertical (**+v**)]. By default, the anchor point on - the scale is assumed to be the bottom left corner (**BL**), but this + reverse the scale bar. Append **+e** to add sidebar triangles for + back- and/or foreground colors. Append **f** (foreground) or **b** + (background) for only one sidebar triangle [Default gives both]. + Optionally, append triangle *length* [Default is half the barwidth]. + The back and/or foreground colors are taken from your B and F colors + in your CPT. If none then the system default colors for B and F are + used instead (:gmt-term:`COLOR_BACKGROUND` and + :gmt-term:`COLOR_FOREGROUND`). Append **+h** to get a horizontal + scale [Default is vertical (**+v**)]. By default, the anchor point on + the scale is assumed to be the bottom left corner (**BL**), but this can be changed by appending **+j** followed by a :doc:`2-character justification code ` *justify*. From 6eb645e0803a83ac2dc3630a95b7e43fe33e1a2e Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 16 Dec 2025 10:02:45 +0100 Subject: [PATCH 3/4] add other descriptions --- pygmt/src/colorbar.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pygmt/src/colorbar.py b/pygmt/src/colorbar.py index 74ec2025b4f..9970966dfe7 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -80,7 +80,7 @@ def colorbar( # noqa: PLR0913 [**+w**\ *length*\ [/\ *width*]]\ [**+e**\ [**b**\|\ **f**][*length*]]\ [**+h**\|\ **v**][**+j**\ *justify*]\ [**+m**\ [**a**\|\ **c**\|\ **l**\|\ **u**]]\ - [**+n**\ [*txt*]][**+o**\ *dx*\ [/*dy*]]. + [**+n**\ [*text*]][**+o**\ *dx*\ [/*dy*]]. Define the reference point on the map for the color scale using one of four coordinate systems: (1) Use **g** for map (user) coordinates, (2) use **j** or **J** for setting *refpoint* via a @@ -103,7 +103,19 @@ def colorbar( # noqa: PLR0913 the scale is assumed to be the bottom left corner (**BL**), but this can be changed by appending **+j** followed by a :doc:`2-character justification code ` - *justify*. + *justify*. Append **+m** to move text to opposite side as per arguments + [**a**|**c**|**l**|**u**]. Horizontal scale bars: Move annotations and + labels above the scale bar [Default is below]; the unit remains on the + left. Vertical scale bars: Move annotations and labels to the left of + the scale bar [Default is to the right]; the unit remains below. + Append one or more of **a**, **l** or **u** to control which of + the annotations, label, and unit that will be moved to the opposite + side. Append **c** if you want to print a vertical label as a column + of characters (does not work with special characters). + Append **+n** to plot a rectangle with the NaN color (via the **N** + entry in your cpt (or :gmt-term:`COLOR_NAN` if no such entry) at the + start of the bar, append *text* to change label from NaN. To place it + at the end of the bar, use **+N** instead. box Draw a background box behind the colorbar. If set to ``True``, a simple rectangular box is drawn using :gmt-term:`MAP_FRAME_PEN`. To customize the box From 224025cac27723489e85f779ea429cc47f6166a7 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 16 Dec 2025 10:15:12 +0100 Subject: [PATCH 4/4] Update colorbar.py --- pygmt/src/colorbar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/colorbar.py b/pygmt/src/colorbar.py index 9970966dfe7..b6705aa88b1 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -104,7 +104,7 @@ def colorbar( # noqa: PLR0913 can be changed by appending **+j** followed by a :doc:`2-character justification code ` *justify*. Append **+m** to move text to opposite side as per arguments - [**a**|**c**|**l**|**u**]. Horizontal scale bars: Move annotations and + [**a**\|\ **c**\|\ **l**\|\ **u**]. Horizontal scale bars: Move annotations and labels above the scale bar [Default is below]; the unit remains on the left. Vertical scale bars: Move annotations and labels to the left of the scale bar [Default is to the right]; the unit remains below.