From 77330ce53377ce1f578da8eaf302b6bc7ba4db01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sat, 21 Jun 2025 18:02:21 +0200 Subject: [PATCH 01/23] Add code for text formatting gallery example --- .../gallery/embellishments/text_formatting.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 examples/gallery/embellishments/text_formatting.py diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py new file mode 100755 index 00000000000..0738439b860 --- /dev/null +++ b/examples/gallery/embellishments/text_formatting.py @@ -0,0 +1,34 @@ +""" +Text formatting +=============== + +Formatting of text added to a plot or labels of colorbars. +:doc:`Text Formatting ` and :doc:`Fonts ` +""" + +# %% +import pygmt + +fig = pygmt.Figure() +fig.basemap(region=[-5, 5, -5, 5], projection="X10c", frame=0) + +# Change font color, size and style for single characters +fig.text(x=0, y=2, text="t@;red;e@;;xt te@:15:x@::t tex@%Courier-Oblique%t@%%") +# t@;red;e@;;@:15:x@::@%Courier-Oblique%t@%%") + +# Superscript +fig.text(x=0, y=1, text="E = mc@+2@+") + +# Subscripts and Greek letters +fig.text(x=0, y=0, text="@~s@~@-ij@- = c@-ijkl@- @~e@~@-ij@-") + +# Combine two characters above each other +fig.text(x=0, y=-1, text="@!_~") + +# Underline the text +fig.text(x=0, y=-2, text="@_underlined text@_") + +# Use small caps +fig.text(x=0, y=-3, text="@#text in small caps@#") + +fig.show() From 760d5fda5f2d620e569461497307cb6995e25b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sat, 21 Jun 2025 18:03:52 +0200 Subject: [PATCH 02/23] Remove execution permission --- examples/gallery/embellishments/text_formatting.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 examples/gallery/embellishments/text_formatting.py diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py old mode 100755 new mode 100644 From 26f0c6461f1496d6a5c4be29971a220e19e4986f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sat, 21 Jun 2025 18:04:56 +0200 Subject: [PATCH 03/23] Follow code style --- .../gallery/embellishments/text_formatting.py | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index 0738439b860..e99551c95e3 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -1,34 +1,34 @@ -""" -Text formatting -=============== - -Formatting of text added to a plot or labels of colorbars. -:doc:`Text Formatting ` and :doc:`Fonts ` -""" - -# %% -import pygmt - -fig = pygmt.Figure() -fig.basemap(region=[-5, 5, -5, 5], projection="X10c", frame=0) - -# Change font color, size and style for single characters -fig.text(x=0, y=2, text="t@;red;e@;;xt te@:15:x@::t tex@%Courier-Oblique%t@%%") -# t@;red;e@;;@:15:x@::@%Courier-Oblique%t@%%") - -# Superscript -fig.text(x=0, y=1, text="E = mc@+2@+") - -# Subscripts and Greek letters -fig.text(x=0, y=0, text="@~s@~@-ij@- = c@-ijkl@- @~e@~@-ij@-") - -# Combine two characters above each other -fig.text(x=0, y=-1, text="@!_~") - -# Underline the text -fig.text(x=0, y=-2, text="@_underlined text@_") - -# Use small caps -fig.text(x=0, y=-3, text="@#text in small caps@#") - -fig.show() +""" +Text formatting +=============== + +Formatting of text added to a plot or labels of colorbars. +:doc:`Text Formatting ` and :doc:`Fonts ` +""" + +# %% +import pygmt + +fig = pygmt.Figure() +fig.basemap(region=[-5, 5, -5, 5], projection="X10c", frame=0) + +# Change font color, size and style for single characters +fig.text(x=0, y=2, text="t@;red;e@;;xt te@:15:x@::t tex@%Courier-Oblique%t@%%") +# t@;red;e@;;@:15:x@::@%Courier-Oblique%t@%%") + +# Superscript +fig.text(x=0, y=1, text="E = mc@+2@+") + +# Subscripts and Greek letters +fig.text(x=0, y=0, text="@~s@~@-ij@- = c@-ijkl@- @~e@~@-ij@-") + +# Combine two characters above each other +fig.text(x=0, y=-1, text="@!_~") + +# Underline the text +fig.text(x=0, y=-2, text="@_underlined text@_") + +# Use small caps +fig.text(x=0, y=-3, text="@#text in small caps@#") + +fig.show() From 4c5d25b653ed33f05d09c264007769e11839b619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sat, 21 Jun 2025 18:22:15 +0200 Subject: [PATCH 04/23] Split code --- examples/gallery/embellishments/text_formatting.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index e99551c95e3..8965faf05f9 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -12,9 +12,11 @@ fig = pygmt.Figure() fig.basemap(region=[-5, 5, -5, 5], projection="X10c", frame=0) -# Change font color, size and style for single characters -fig.text(x=0, y=2, text="t@;red;e@;;xt te@:15:x@::t tex@%Courier-Oblique%t@%%") -# t@;red;e@;;@:15:x@::@%Courier-Oblique%t@%%") +# Change font color for specific characters +fig.text(x=0, y=3, text="@;63/124/173;P@;;@;255/212/59;y@;;@;238/86/52;GMT@;;") + +# Change font size and style for a single character, respectively +fig.text(x=0, y=2, text="te@:15:x@::t tex@%Courier-Oblique%t@%%") # Superscript fig.text(x=0, y=1, text="E = mc@+2@+") From 33dc050d3f67382c99fb1d8a9faee92664cd3329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sat, 21 Jun 2025 21:18:57 +0200 Subject: [PATCH 05/23] Add docs --- examples/gallery/embellishments/text_formatting.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index 8965faf05f9..e32b9d15884 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -2,8 +2,11 @@ Text formatting =============== -Formatting of text added to a plot or labels of colorbars. -:doc:`Text Formatting ` and :doc:`Fonts ` +There are different options to format text added to a plot as well as labels of +colorbars and Cartesian axes, including, superscripts, subscripts, underlining and +small caps (:doc:`Text Formatting `). It's also possible +to change the font as well as its color and size only for specific characters of a +longer text. The supported fonts are listed at :doc:`Fonts `. """ # %% From ec9a6a8c4f67098bf4adb60ce42954708ddfc76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sat, 21 Jun 2025 21:27:05 +0200 Subject: [PATCH 06/23] Fix typo --- examples/gallery/embellishments/text_formatting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index e32b9d15884..5be473a461f 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -6,7 +6,7 @@ colorbars and Cartesian axes, including, superscripts, subscripts, underlining and small caps (:doc:`Text Formatting `). It's also possible to change the font as well as its color and size only for specific characters of a -longer text. The supported fonts are listed at :doc:`Fonts `. +longer text. The supported fonts are listed at :doc:`Fonts `. """ # %% From 74933b166771f112ac912371c6477ba553b26edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sat, 21 Jun 2025 22:16:38 +0200 Subject: [PATCH 07/23] Use line length --- examples/gallery/embellishments/text_formatting.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index 5be473a461f..6e29c87476c 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -3,10 +3,10 @@ =============== There are different options to format text added to a plot as well as labels of -colorbars and Cartesian axes, including, superscripts, subscripts, underlining and -small caps (:doc:`Text Formatting `). It's also possible -to change the font as well as its color and size only for specific characters of a -longer text. The supported fonts are listed at :doc:`Fonts `. +colorbars and Cartesian axes, including, superscripts, subscripts, underlining and small +caps (:doc:`Text Formatting `). It's also possible to change +the font as well as its color and size only for specific characters of a longer text. +The supported fonts are listed at :doc:`Supported Fonts `. """ # %% From b622a53358385d6cd479efa91bcdd28fbce5206f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sun, 22 Jun 2025 08:27:17 +0200 Subject: [PATCH 08/23] Mention legnd in docs --- examples/gallery/embellishments/text_formatting.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index 6e29c87476c..dfabb8eed89 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -3,10 +3,11 @@ =============== There are different options to format text added to a plot as well as labels of -colorbars and Cartesian axes, including, superscripts, subscripts, underlining and small -caps (:doc:`Text Formatting `). It's also possible to change -the font as well as its color and size only for specific characters of a longer text. -The supported fonts are listed at :doc:`Supported Fonts `. +colorbars, Cartesian axes and legend entries, including, superscripts, subscripts, +underlining and small caps (:doc:`Text Formatting `). +It's also possible to change the font as well as its color and size only for +specific characters of a longer text. The supported fonts are listed at +:doc:`Supported Fonts `. """ # %% From 5a7d11fcbb0fdf3a28139e3b8dc3ee5be31a0b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sun, 22 Jun 2025 08:30:08 +0200 Subject: [PATCH 09/23] Add comment --- examples/gallery/embellishments/text_formatting.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index dfabb8eed89..d1686b0453e 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -16,7 +16,8 @@ fig = pygmt.Figure() fig.basemap(region=[-5, 5, -5, 5], projection="X10c", frame=0) -# Change font color for specific characters +# Change font color for specific characters of the word "PyGMT" +# blue for "P", yellow for "y", and red for "GMT" fig.text(x=0, y=3, text="@;63/124/173;P@;;@;255/212/59;y@;;@;238/86/52;GMT@;;") # Change font size and style for a single character, respectively From 7b980b2ef458dc4fe350714c86c034add5f908b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sun, 22 Jun 2025 08:30:23 +0200 Subject: [PATCH 10/23] Fix typo in formular --- examples/gallery/embellishments/text_formatting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index d1686b0453e..ba02f4076fd 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -27,7 +27,7 @@ fig.text(x=0, y=1, text="E = mc@+2@+") # Subscripts and Greek letters -fig.text(x=0, y=0, text="@~s@~@-ij@- = c@-ijkl@- @~e@~@-ij@-") +fig.text(x=0, y=0, text="@~s@~@-ij@- = c@-ijkl@- @~e@~@-kl@-") # Combine two characters above each other fig.text(x=0, y=-1, text="@!_~") From 45a74c9cae76b85a428023654cf091c15cad6c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sun, 22 Jun 2025 08:39:24 +0200 Subject: [PATCH 11/23] Adjust figure dimensions --- examples/gallery/embellishments/text_formatting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index ba02f4076fd..7130e0a0aae 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -14,7 +14,7 @@ import pygmt fig = pygmt.Figure() -fig.basemap(region=[-5, 5, -5, 5], projection="X10c", frame=0) +fig.basemap(region=[-5, 5, -4, 4], projection="X10c/6c", frame=0) # Change font color for specific characters of the word "PyGMT" # blue for "P", yellow for "y", and red for "GMT" From 48d045e6075ca309cd8d0c1ac75f1247d000124e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sun, 22 Jun 2025 08:49:03 +0200 Subject: [PATCH 12/23] Mention title in doc --- examples/gallery/embellishments/text_formatting.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index 7130e0a0aae..6a58bb18743 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -2,12 +2,12 @@ Text formatting =============== -There are different options to format text added to a plot as well as labels of -colorbars, Cartesian axes and legend entries, including, superscripts, subscripts, -underlining and small caps (:doc:`Text Formatting `). -It's also possible to change the font as well as its color and size only for -specific characters of a longer text. The supported fonts are listed at -:doc:`Supported Fonts `. +There are various options to format text added to a plot as well as the title of the +plot and labels of colorbars, Cartesian axes and legend entries, including, +superscripts, subscripts, underlining and small caps (for an overview see +(:doc:`Text Formatting `). It's also possible to change the +font as well as its color and size only for specific characters of a longer text. The +supported fonts are listed at :doc:`Supported Fonts `. """ # %% From 084a036fdf7134451d093bd5fbed34197265cafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sun, 22 Jun 2025 08:55:54 +0200 Subject: [PATCH 13/23] Adjust figure dimensions and add comma --- examples/gallery/embellishments/text_formatting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index 6a58bb18743..619c4653e03 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -3,7 +3,7 @@ =============== There are various options to format text added to a plot as well as the title of the -plot and labels of colorbars, Cartesian axes and legend entries, including, +plot and labels of colorbars, Cartesian axes, and legend entries, including, superscripts, subscripts, underlining and small caps (for an overview see (:doc:`Text Formatting `). It's also possible to change the font as well as its color and size only for specific characters of a longer text. The @@ -14,7 +14,7 @@ import pygmt fig = pygmt.Figure() -fig.basemap(region=[-5, 5, -4, 4], projection="X10c/6c", frame=0) +fig.basemap(region=[-1, 1, -4, 4], projection="X4c/5c", frame=0) # Change font color for specific characters of the word "PyGMT" # blue for "P", yellow for "y", and red for "GMT" From 15b2b8e71a9ded00119708109c8e716bc5d51bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Mon, 7 Jul 2025 20:33:22 +0200 Subject: [PATCH 14/23] Update docs --- .../gallery/embellishments/text_formatting.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index 619c4653e03..44d98f51e2f 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -2,12 +2,12 @@ Text formatting =============== -There are various options to format text added to a plot as well as the title of the -plot and labels of colorbars, Cartesian axes, and legend entries, including, -superscripts, subscripts, underlining and small caps (for an overview see -(:doc:`Text Formatting `). It's also possible to change the -font as well as its color and size only for specific characters of a longer text. The -supported fonts are listed at :doc:`Supported Fonts `. +There are various options to format text contained in a plot, e.g., text added via +:meth:`pygmt.Figure.text`, title of a plot, labels of colorbars and Cartesian axes, +and legend entries. It's also possible to change the font as well as its color and +size only for specific characters of a longer text. The supported fonts are listed +at :doc:`Supported Fonts `. For an complete overview see +:doc:`Text Formatting `. """ # %% @@ -20,13 +20,13 @@ # blue for "P", yellow for "y", and red for "GMT" fig.text(x=0, y=3, text="@;63/124/173;P@;;@;255/212/59;y@;;@;238/86/52;GMT@;;") -# Change font size and style for a single character, respectively +# Change font size and style for one single character, respectively fig.text(x=0, y=2, text="te@:15:x@::t tex@%Courier-Oblique%t@%%") -# Superscript +# Use superscript fig.text(x=0, y=1, text="E = mc@+2@+") -# Subscripts and Greek letters +# Use subscripts and Greek letters fig.text(x=0, y=0, text="@~s@~@-ij@- = c@-ijkl@- @~e@~@-kl@-") # Combine two characters above each other From 2462e992132a0ccab2858fb9749bde18ebd86c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Mon, 7 Jul 2025 20:35:01 +0200 Subject: [PATCH 15/23] Update docs --- examples/gallery/embellishments/text_formatting.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index 44d98f51e2f..66b9c61654c 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -3,11 +3,11 @@ =============== There are various options to format text contained in a plot, e.g., text added via -:meth:`pygmt.Figure.text`, title of a plot, labels of colorbars and Cartesian axes, -and legend entries. It's also possible to change the font as well as its color and -size only for specific characters of a longer text. The supported fonts are listed -at :doc:`Supported Fonts `. For an complete overview see -:doc:`Text Formatting `. +:meth:`pygmt.Figure.text`, the title of the plot, labels of colorbars as well as +Cartesian axes, and legend entries. It's also possible to change the font as well +as its color and size only for specific characters of a longer text. The supported +fonts are listed at :doc:`Supported Fonts `. For an complete +overview see :doc:`Text Formatting `. """ # %% From f693d3507df6eeb0fb2c7ea444f4af1222e6510d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Mon, 7 Jul 2025 21:26:18 +0200 Subject: [PATCH 16/23] Remove double white space --- examples/gallery/embellishments/text_formatting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index 66b9c61654c..19084ce0c61 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -6,7 +6,7 @@ :meth:`pygmt.Figure.text`, the title of the plot, labels of colorbars as well as Cartesian axes, and legend entries. It's also possible to change the font as well as its color and size only for specific characters of a longer text. The supported -fonts are listed at :doc:`Supported Fonts `. For an complete +fonts are listed at :doc:`Supported Fonts `. For an complete overview see :doc:`Text Formatting `. """ From 98cf164c8791289d63a4141cce13b476f37eba3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Fri, 11 Jul 2025 15:24:32 +0200 Subject: [PATCH 17/23] Update docs --- examples/gallery/embellishments/text_formatting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index 19084ce0c61..907ede36eaa 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -2,8 +2,8 @@ Text formatting =============== -There are various options to format text contained in a plot, e.g., text added via -:meth:`pygmt.Figure.text`, the title of the plot, labels of colorbars as well as +There are various options for formatting text contained in a plot, e.g., text added +via :meth:`pygmt.Figure.text`, the plot title, labels of colorbars as well as Cartesian axes, and legend entries. It's also possible to change the font as well as its color and size only for specific characters of a longer text. The supported fonts are listed at :doc:`Supported Fonts `. For an complete From cde3f5edb9aee74a6496aac692671027728d6e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Sat, 19 Jul 2025 14:28:09 +0200 Subject: [PATCH 18/23] Write complete sentence Co-authored-by: Dongdong Tian --- examples/gallery/embellishments/text_formatting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index 907ede36eaa..dd2172b1d91 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -33,7 +33,7 @@ fig.text(x=0, y=-1, text="@!_~") # Underline the text -fig.text(x=0, y=-2, text="@_underlined text@_") +fig.text(x=0, y=-2, text="This is @_underlined@_ text") # Use small caps fig.text(x=0, y=-3, text="@#text in small caps@#") From c05aa65244261be35f17451a0a53046cbf2d4e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Sat, 19 Jul 2025 14:31:12 +0200 Subject: [PATCH 19/23] Write only letters within the words in small caps Co-authored-by: Dongdong Tian --- examples/gallery/embellishments/text_formatting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index dd2172b1d91..b678ef24a63 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -36,6 +36,6 @@ fig.text(x=0, y=-2, text="This is @_underlined@_ text") # Use small caps -fig.text(x=0, y=-3, text="@#text in small caps@#") +fig.text(x=0, y=-3, text="T@#ext@# in S@#mall@# C@#aps@#") fig.show() From 404bf4dc7dbf0df56e11e491b44168071802d53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sat, 19 Jul 2025 15:46:01 +0200 Subject: [PATCH 20/23] TEST - exclude image in legend tutorial --- examples/tutorials/advanced/legends.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/legends.py b/examples/tutorials/advanced/legends.py index 15598bc7343..d55d272e1d6 100644 --- a/examples/tutorials/advanced/legends.py +++ b/examples/tutorials/advanced/legends.py @@ -133,7 +133,7 @@ G 0.1c M 5 5 600+u+f G 0.1c -I @SOEST_block4.png 3i CT +#I @SOEST_block4.png 3i CT G 0.05c L 9p,Times-Roman R Smith et al., @%5%J. Geophys. Res., 99@%%, 2000 G 0.1c From ab0d6c562f842b9cbe670838623490ba26f415f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sat, 19 Jul 2025 15:52:44 +0200 Subject: [PATCH 21/23] Revert "TEST - exclude image in legend tutorial" This reverts commit 404bf4dc7dbf0df56e11e491b44168071802d53e. --- examples/tutorials/advanced/legends.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/legends.py b/examples/tutorials/advanced/legends.py index d55d272e1d6..15598bc7343 100644 --- a/examples/tutorials/advanced/legends.py +++ b/examples/tutorials/advanced/legends.py @@ -133,7 +133,7 @@ G 0.1c M 5 5 600+u+f G 0.1c -#I @SOEST_block4.png 3i CT +I @SOEST_block4.png 3i CT G 0.05c L 9p,Times-Roman R Smith et al., @%5%J. Geophys. Res., 99@%%, 2000 G 0.1c From 3764dec90d198ce0977b225eec7ab973141d4cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sat, 19 Jul 2025 22:56:33 +0200 Subject: [PATCH 22/23] Fix line length --- examples/gallery/embellishments/text_formatting.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index b678ef24a63..2951e33041d 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -2,12 +2,12 @@ Text formatting =============== -There are various options for formatting text contained in a plot, e.g., text added -via :meth:`pygmt.Figure.text`, the plot title, labels of colorbars as well as -Cartesian axes, and legend entries. It's also possible to change the font as well -as its color and size only for specific characters of a longer text. The supported -fonts are listed at :doc:`Supported Fonts `. For an complete -overview see :doc:`Text Formatting `. +There are various options for formatting text contained in a plot, e.g., text added via +:meth:`pygmt.Figure.text`, the plot title, labels of colorbars as well as Cartesian +axes, and legend entries. It's also possible to change the font as well as its color +and size only for specific characters of a longer text. The supported fonts are listed +at :doc:`Supported Fonts `. For an complete overview see +:doc:`Text Formatting `. """ # %% @@ -16,7 +16,7 @@ fig = pygmt.Figure() fig.basemap(region=[-1, 1, -4, 4], projection="X4c/5c", frame=0) -# Change font color for specific characters of the word "PyGMT" +# Change font color for specific characters of the word "PyGMT": # blue for "P", yellow for "y", and red for "GMT" fig.text(x=0, y=3, text="@;63/124/173;P@;;@;255/212/59;y@;;@;238/86/52;GMT@;;") From c6d5f860fa2b6db7cd86146c95dee357d05cd92e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sun, 20 Jul 2025 09:56:10 +0200 Subject: [PATCH 23/23] Adjust word --- examples/gallery/embellishments/text_formatting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/text_formatting.py b/examples/gallery/embellishments/text_formatting.py index 2951e33041d..db6580c4ac5 100644 --- a/examples/gallery/embellishments/text_formatting.py +++ b/examples/gallery/embellishments/text_formatting.py @@ -16,7 +16,7 @@ fig = pygmt.Figure() fig.basemap(region=[-1, 1, -4, 4], projection="X4c/5c", frame=0) -# Change font color for specific characters of the word "PyGMT": +# Change font color for specific letters of the word "PyGMT": # blue for "P", yellow for "y", and red for "GMT" fig.text(x=0, y=3, text="@;63/124/173;P@;;@;255/212/59;y@;;@;238/86/52;GMT@;;")