Skip to content

Commit ed3ba86

Browse files
Fix typos in tutorial and docs "text.py" (#2191)
1 parent 7a1a06d commit ed3ba86

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

examples/tutorials/basics/text.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Plotting text
33
=============
44
5-
It is often useful to add annotations to a map plot. This is handled by
5+
It is often useful to add annotations to a plot. This is handled by
66
:meth:`pygmt.Figure.text`.
77
"""
88
# sphinx_gallery_thumbnail_number = 3
@@ -20,18 +20,18 @@
2020
#
2121
# Here we create a simple map and add an annotation using the ``text``, ``x``,
2222
# and ``y`` parameters to specify the annotation text and position in the
23-
# projection frame. ``text`` accepts *str* types, while ``x``, and ``y``
24-
# accepts either *int* or *float* numbers, or a list/array of numbers.
23+
# projection frame. ``text`` accepts *str* types, while ``x`` and ``y``
24+
# accept either *int* or *float* numbers, or a list/array of numbers.
2525

2626
fig = pygmt.Figure()
2727
with pygmt.config(MAP_FRAME_TYPE="plain"):
2828
fig.basemap(region=[108, 120, -5, 8], projection="M20c", frame="a")
2929
fig.coast(land="black", water="skyblue")
3030

31-
# Plot text annotations using a single element
31+
# Plot text annotations using single arguments
3232
fig.text(text="SOUTH CHINA SEA", x=112, y=6)
3333

34-
# Plot text annotations using lists of elements
34+
# Plot text annotations using lists of arguments
3535
fig.text(text=["CELEBES SEA", "JAVA SEA"], x=[119, 112], y=[3.25, -4.6])
3636

3737
fig.show()
@@ -61,7 +61,7 @@
6161
# -------------------------
6262
#
6363
# It is also possible to add annotations from a file containing ``x``, ``y``,
64-
# and ``text`` fields. Here we give a complete example.
64+
# and ``text`` columns. Here we give a complete example.
6565

6666
fig = pygmt.Figure()
6767
with pygmt.config(MAP_FRAME_TYPE="plain"):
@@ -97,8 +97,8 @@
9797
# being added to a plot. The following code segment demonstrates the
9898
# positioning of the anchor point relative to the text.
9999
#
100-
# The anchor is specified with a two letter (order independent) code, chosen
101-
# from:
100+
# The anchor point is specified with a two-letter (order independent) code,
101+
# chosen from:
102102
#
103103
# * Vertical anchor: **T**\(op), **M**\(iddle), **B**\(ottom)
104104
# * Horizontal anchor: **L**\(eft), **C**\(entre), **R**\(ight)
@@ -117,8 +117,8 @@
117117
###############################################################################
118118
# ``angle`` parameter
119119
# -------------------
120-
# ``angle`` is an optional parameter used to specify the clockwise rotation of
121-
# the text from the horizontal.
120+
# ``angle`` is an optional parameter used to specify the counter-clockwise
121+
# rotation in degrees of the text from the horizontal.
122122

123123
fig = pygmt.Figure()
124124
fig.basemap(region=[0, 4, 0, 4], projection="X5c", frame="WSen")

pygmt/src/text.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,20 @@ def text_(
8181
records with (x, y[, angle, font, justify], text).
8282
x/y : float or 1d arrays
8383
The x and y coordinates, or an array of x and y coordinates to plot
84-
the text
84+
the text.
8585
position : str
86-
Sets reference point on the map for the text by using x,y
86+
Sets reference point on the map for the text by using x, y
8787
coordinates extracted from ``region`` instead of providing them
88-
through ``x``/``y``. Specify with a two letter (order independent)
88+
through ``x``/``y``. Specify with a two-letter (order independent)
8989
code, chosen from:
9090
9191
* Horizontal: **L**\ (eft), **C**\ (entre), **R**\ (ight)
9292
* Vertical: **T**\ (op), **M**\ (iddle), **B**\ (ottom)
9393
94-
For example, ``position="TL"`` plots the text at the Upper Left corner
94+
For example, ``position="TL"`` plots the text at the Top Left corner
9595
of the map.
9696
text : str or 1d array
97-
The text string, or an array of strings to plot on the figure
97+
The text string, or an array of strings to plot on the figure.
9898
angle: int, float, str or bool
9999
Set the angle measured in degrees counter-clockwise from
100100
horizontal (e.g. 30 sets the text at 30 degrees). If no angle is
@@ -110,11 +110,12 @@ def text_(
110110
columns.
111111
justify : str or bool
112112
Set the alignment which refers to the part of the text string that
113-
will be mapped onto the (x,y) point. Choose a 2 character
113+
will be mapped onto the (x, y) point. Choose a two-letter
114114
combination of **L**, **C**, **R** (for left, center, or right) and
115-
**T**, **M**, **B** for top, middle, or bottom. E.g., **BL** for lower
116-
left. If no justification is explicitly given (i.e. ``justify=True``),
117-
then the input to ``textfiles`` must have this as a column.
115+
**T**, **M**, **B** (for top, middle, or bottom). E.g., **BL** for
116+
bottom left. If no justification is explicitly given
117+
(i.e. ``justify=True``), then the input to ``textfiles`` must have
118+
this as a column.
118119
{projection}
119120
{region}
120121
*Required if this is the first plot command.*
@@ -125,7 +126,7 @@ def text_(
125126
specified. Append the unit you want (*c* for cm, *i* for inch, or *p*
126127
for point; if not given we consult :gmt-term:`PROJ_LENGTH_UNIT`)
127128
or *%* for a percentage of the font size. Optionally, use modifier
128-
**+t** to set the shape of the textbox when using ``fill`` and/or
129+
**+t** to set the shape of the text box when using ``fill`` and/or
129130
``pen``. Append lower case **o** to get a straight rectangle
130131
[Default is **o**]. Append upper case **O** to get a rounded
131132
rectangle. In paragraph mode (*paragraph*) you can also append lower
@@ -136,7 +137,8 @@ def text_(
136137
no fill].
137138
offset : str
138139
[**j**\|\ **J**]\ *dx*\[/*dy*][**+v**\[*pen*]].
139-
Offsets the text from the projected (x,y) point by *dx*,\ *dy* [0/0].
140+
Offsets the text from the projected (x, y) point by *dx*/\ *dy*
141+
[Default is ``"0/0"``].
140142
If *dy* is not specified then it is set equal to *dx*. Use **j** to
141143
offset the text away from the point instead (i.e., the text
142144
justification will determine the direction of the shift). Using
@@ -148,7 +150,7 @@ def text_(
148150
Sets the pen used to draw a rectangle around the text string
149151
(see ``clearance``) [Default is ``"0.25p,black,solid"``].
150152
no_clip : bool
151-
Do NOT clip text at map boundaries [Default is will clip].
153+
Do NOT clip text at map boundaries [Default is with clip].
152154
{timestamp}
153155
{verbose}
154156
{xyshift}

0 commit comments

Comments
 (0)