From 13590f67994c91c414c71c4d40a589896608244c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Mon, 29 Sep 2025 14:21:06 +0200 Subject: [PATCH 01/14] Add note regarding automatic fontsize scaling --- pygmt/src/colorbar.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pygmt/src/colorbar.py b/pygmt/src/colorbar.py index 857f0712e8e..f6c8a525306 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -48,6 +48,11 @@ def colorbar( linear scale, all be equal size, or by providing a file with individual tile widths. + .. note:: + Up on GMT 6.5.0 the fontsize of the colorbar label is scaled relatively + based on the width of the colorbar. So, changing this fontsize via the + setting the GMT defaults does not work as expected. + Full GMT docs at :gmt-docs:`colorbar.html`. {aliases} From 0c55a4875706757911a198a99d39d3cd77b4e02b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Mon, 29 Sep 2025 14:57:57 +0200 Subject: [PATCH 02/14] Add more information --- pygmt/src/colorbar.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pygmt/src/colorbar.py b/pygmt/src/colorbar.py index f6c8a525306..863c68e4936 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -49,9 +49,10 @@ def colorbar( tile widths. .. note:: - Up on GMT 6.5.0 the fontsize of the colorbar label is scaled relatively - based on the width of the colorbar. So, changing this fontsize via the - setting the GMT defaults does not work as expected. + Up on GMT 6.5.0, the fontsize of the colorbar label is scaled relatively + based on the width of the colorbar (square_root(colorbar_width / 15)). + Currently, in modern mode, changing this fontsize via the GMT defaults + does not work as expected. Full GMT docs at :gmt-docs:`colorbar.html`. From 1fded9bfc1d899c9877fd27a18e35f68591944fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Mon, 29 Sep 2025 15:46:45 +0200 Subject: [PATCH 03/14] Use math mode --- 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 863c68e4936..1d0988911a4 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -50,7 +50,7 @@ def colorbar( .. note:: Up on GMT 6.5.0, the fontsize of the colorbar label is scaled relatively - based on the width of the colorbar (square_root(colorbar_width / 15)). + based on the width of the colorbar (:math:`\sqrt{colorbar_width / 15}`). Currently, in modern mode, changing this fontsize via the GMT defaults does not work as expected. From f56ae848bcdf1dc9b43c12d48cf16576bd604aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Mon, 29 Sep 2025 16:20:03 +0200 Subject: [PATCH 04/14] Fix math synthax --- 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 1d0988911a4..70c87e6d9d8 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -50,7 +50,7 @@ def colorbar( .. note:: Up on GMT 6.5.0, the fontsize of the colorbar label is scaled relatively - based on the width of the colorbar (:math:`\sqrt{colorbar_width / 15}`). + based on the width of the colorbar (:math:`\sqrt{{colorbar_width / 15}}`). Currently, in modern mode, changing this fontsize via the GMT defaults does not work as expected. From 0e27f138eb95683d1143e1f6f96d2f9d99a7e9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Mon, 29 Sep 2025 16:28:01 +0200 Subject: [PATCH 05/14] Remove underscore --- 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 70c87e6d9d8..3ee9808409a 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -50,7 +50,7 @@ def colorbar( .. note:: Up on GMT 6.5.0, the fontsize of the colorbar label is scaled relatively - based on the width of the colorbar (:math:`\sqrt{{colorbar_width / 15}}`). + based on the width of the colorbar (:math:`\sqrt{{colorbarwidth / 15}}`). Currently, in modern mode, changing this fontsize via the GMT defaults does not work as expected. From 693be21b1762a37a3da7f86d9c6103eac24a6e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Mon, 29 Sep 2025 20:19:41 +0200 Subject: [PATCH 06/14] Add more information --- pygmt/src/colorbar.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pygmt/src/colorbar.py b/pygmt/src/colorbar.py index 3ee9808409a..50a3e7c454b 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -49,10 +49,10 @@ def colorbar( tile widths. .. note:: - Up on GMT 6.5.0, the fontsize of the colorbar label is scaled relatively - based on the width of the colorbar (:math:`\sqrt{{colorbarwidth / 15}}`). - Currently, in modern mode, changing this fontsize via the GMT defaults - does not work as expected. + Up on GMT 6.5.0, the fontsize of the colorbar label is scaled based on the + width of the colorbar (:math:`\sqrt{{colorbarwidth / 15}}`). Currently, in + modern mode, changing this fontsize via adjusting the GMT default parameter + :gmt-term:`FONT_LABEL` does not work as expected. Full GMT docs at :gmt-docs:`colorbar.html`. From b3c6adacc62b61b76f9f4d57e657fdf725b55eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Tue, 30 Sep 2025 20:46:06 +0200 Subject: [PATCH 07/14] TEST: fix docs warning regarding pattern class --- pygmt/params/pattern.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/params/pattern.py b/pygmt/params/pattern.py index 33c83a569cd..40029e38811 100644 --- a/pygmt/params/pattern.py +++ b/pygmt/params/pattern.py @@ -31,7 +31,7 @@ class Pattern(BaseParam): :width: 75% :align: center - Parameters + Attributes ---------- pattern The pattern to use. It can be specified in two forms: From 35dad14871efa8005327e325653f5cebdf07f278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Tue, 30 Sep 2025 21:02:37 +0200 Subject: [PATCH 08/14] TEST: Use 'Parameters' --- pygmt/params/box.py | 2 +- pygmt/params/pattern.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/params/box.py b/pygmt/params/box.py index 280dddac1e0..3df0a64fc92 100644 --- a/pygmt/params/box.py +++ b/pygmt/params/box.py @@ -18,7 +18,7 @@ class Box(BaseParam): """ Class for specifying the box around GMT embellishments. - Attributes + Parameters ---------- clearance Set clearances between the embellishment and the box border. It can be either a diff --git a/pygmt/params/pattern.py b/pygmt/params/pattern.py index 40029e38811..33c83a569cd 100644 --- a/pygmt/params/pattern.py +++ b/pygmt/params/pattern.py @@ -31,7 +31,7 @@ class Pattern(BaseParam): :width: 75% :align: center - Attributes + Parameters ---------- pattern The pattern to use. It can be specified in two forms: From 7f05b32a6b5697feae1bdc44f0db3e2773ef7e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Tue, 30 Sep 2025 21:33:43 +0200 Subject: [PATCH 09/14] Revert change --- pygmt/params/box.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/params/box.py b/pygmt/params/box.py index 3df0a64fc92..280dddac1e0 100644 --- a/pygmt/params/box.py +++ b/pygmt/params/box.py @@ -18,7 +18,7 @@ class Box(BaseParam): """ Class for specifying the box around GMT embellishments. - Parameters + Attributes ---------- clearance Set clearances between the embellishment and the box border. It can be either a From d6bef9a787bb3b46a5afe259485245d4b4e24745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Tue, 30 Sep 2025 23:11:35 +0200 Subject: [PATCH 10/14] Improve formulation Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- 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 254bb7c0183..fd62cf9d38f 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -50,7 +50,7 @@ def colorbar( tile widths. .. note:: - Up on GMT 6.5.0, the fontsize of the colorbar label is scaled based on the + For GMT 6.5.0 and above, the fontsize of the colorbar label is scaled based on the width of the colorbar (:math:`\sqrt{{colorbarwidth / 15}}`). Currently, in modern mode, changing this fontsize via adjusting the GMT default parameter :gmt-term:`FONT_LABEL` does not work as expected. From f514e26c043588190fae3b66ac150df6a0fc072b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Wed, 1 Oct 2025 00:41:08 +0200 Subject: [PATCH 11/14] Fix line length --- pygmt/src/colorbar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pygmt/src/colorbar.py b/pygmt/src/colorbar.py index fd62cf9d38f..b27d723e3ef 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -50,9 +50,9 @@ def colorbar( tile widths. .. note:: - For GMT 6.5.0 and above, the fontsize of the colorbar label is scaled based on the - width of the colorbar (:math:`\sqrt{{colorbarwidth / 15}}`). Currently, in - modern mode, changing this fontsize via adjusting the GMT default parameter + For GMT 6.5.0 and above, the fontsize of the colorbar label is scaled based + on the width of the colorbar (:math:`\sqrt{{colorbarwidth / 15}}`). Currently, + in modern mode, changing this fontsize via adjusting the GMT default parameter :gmt-term:`FONT_LABEL` does not work as expected. Full GMT docs at :gmt-docs:`colorbar.html`. From 870be824b6747d0ede3840d8cc7264c97330774e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Wed, 1 Oct 2025 14:39:36 +0200 Subject: [PATCH 12/14] Improve formulation to account for all fontsizes and provide workaround --- pygmt/src/colorbar.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pygmt/src/colorbar.py b/pygmt/src/colorbar.py index b27d723e3ef..981678915ba 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -50,10 +50,15 @@ def colorbar( tile widths. .. note:: - For GMT 6.5.0 and above, the fontsize of the colorbar label is scaled based - on the width of the colorbar (:math:`\sqrt{{colorbarwidth / 15}}`). Currently, - in modern mode, changing this fontsize via adjusting the GMT default parameter - :gmt-term:`FONT_LABEL` does not work as expected. + For GMT >=6.5.0, the fontsizes of the colorbar x-label, x-annotations, + and y-label are scaled based on the width of the colorbar following + :math:`\sqrt{{colorbarwidth / 15}}`). To set a desired fontsize via the + GMT default parameters :gmt-term:`FONT_ANNOT_PRIMARY`, + :gmt-term:`FONT_ANNOT_SECONDARY`, and :gmt-term:`FONT_LABEL` (or jointly + :gmt-term:`FONT`) users have to divide the desired fontsize by the value + calculated with the formula given above before passing it to the default + parameters. To only affect the fontsizes related to the colorbar the + defaults should be changed only locally using `with pygmt.config(...):`. Full GMT docs at :gmt-docs:`colorbar.html`. From 3bdf1fdf223f5ce8f5c3e58de6441ae4239325f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Wed, 1 Oct 2025 18:14:07 +0200 Subject: [PATCH 13/14] Fix hilighting for code --- pygmt/src/colorbar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/src/colorbar.py b/pygmt/src/colorbar.py index 981678915ba..c2f5df18754 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -52,13 +52,13 @@ def colorbar( .. note:: For GMT >=6.5.0, the fontsizes of the colorbar x-label, x-annotations, and y-label are scaled based on the width of the colorbar following - :math:`\sqrt{{colorbarwidth / 15}}`). To set a desired fontsize via the + :math:`\sqrt{{colorbar\_width / 15}}`). To set a desired fontsize via the GMT default parameters :gmt-term:`FONT_ANNOT_PRIMARY`, :gmt-term:`FONT_ANNOT_SECONDARY`, and :gmt-term:`FONT_LABEL` (or jointly :gmt-term:`FONT`) users have to divide the desired fontsize by the value calculated with the formula given above before passing it to the default parameters. To only affect the fontsizes related to the colorbar the - defaults should be changed only locally using `with pygmt.config(...):`. + defaults should be changed only locally using ``with pygmt.config(...):``. Full GMT docs at :gmt-docs:`colorbar.html`. From 513840a54fb9f65ee8ec9e5586ee111526a35ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:43:00 +0200 Subject: [PATCH 14/14] Improve formulation and grammar Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/src/colorbar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/src/colorbar.py b/pygmt/src/colorbar.py index c2f5df18754..0eb396f56f5 100644 --- a/pygmt/src/colorbar.py +++ b/pygmt/src/colorbar.py @@ -57,8 +57,8 @@ def colorbar( :gmt-term:`FONT_ANNOT_SECONDARY`, and :gmt-term:`FONT_LABEL` (or jointly :gmt-term:`FONT`) users have to divide the desired fontsize by the value calculated with the formula given above before passing it to the default - parameters. To only affect the fontsizes related to the colorbar the - defaults should be changed only locally using ``with pygmt.config(...):``. + parameters. To only affect fontsizes related to the colorbar, the + defaults can be changed locally only using ``with pygmt.config(...):``. Full GMT docs at :gmt-docs:`colorbar.html`.