Skip to content

DOC: Update docs to use consistently x-* and y-* (with hyphen) #3862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
51bf8f3
Update docs to use consistently x direction and y direction
michaelgrund Mar 19, 2025
b1f0825
Update header.py
michaelgrund Mar 19, 2025
2cdeb73
Update basemap.py
michaelgrund Mar 19, 2025
a65cb2e
Update envelope.py
michaelgrund Mar 19, 2025
466c18f
Update colorbar.py
michaelgrund Mar 19, 2025
74efafe
Update cartesian_histograms.py
michaelgrund Mar 19, 2025
5e727f7
Update inset.py
michaelgrund Mar 19, 2025
20c38df
Update coast.py
michaelgrund Mar 19, 2025
1dc8a71
Merge branch 'main' into updt-docs-dir
michaelgrund Apr 1, 2025
a5c05b2
Update envelope.py
michaelgrund May 28, 2025
940ce91
Merge branch 'main' into updt-docs-dir
michaelgrund May 28, 2025
e760736
Apply suggestions from code review
michaelgrund May 28, 2025
3a76a01
Update scatter3d.py
michaelgrund May 28, 2025
8c1c17a
Update 04_table_inputs.py
michaelgrund May 28, 2025
f3221a5
Update basic_symbols.py
michaelgrund May 28, 2025
7ba74f0
Update blockm.py
michaelgrund May 28, 2025
50b0acb
Update grdclip.py
michaelgrund May 28, 2025
e84c26a
Update grdlandmask.py
michaelgrund May 28, 2025
9d596a4
Update legends.py
michaelgrund May 28, 2025
3d8f4d1
Update cross_section.py
michaelgrund May 28, 2025
3465a2d
Update decorated_lines.py
michaelgrund May 28, 2025
6699c8c
Update gmt_logo.py
michaelgrund May 28, 2025
57a12f8
Update legend.py
michaelgrund May 28, 2025
d1e758f
Update text.py
michaelgrund May 28, 2025
8e9d6f5
Update shift_origin.py
michaelgrund May 28, 2025
9e37c7f
Update quoted_lines.py
michaelgrund May 28, 2025
3703eac
Update scatter_and_histograms.py
michaelgrund May 28, 2025
be78ee3
Update timestamp.py
michaelgrund May 28, 2025
63c6360
Update project.py
michaelgrund May 28, 2025
0784c62
Update decorated_lines.py
michaelgrund May 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/gallery/3d_plots/scatter3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
zscale=1.5,
)

# Shift the plot origin in x direction temporarily and add the colorbar
# Shift the plot origin in x-direction temporarily and add the colorbar
with fig.shift_origin(xshift=3.1):
fig.colorbar()

Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/embellishments/gmt_logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
fig.basemap(region=[0, 10, 0, 2], projection="X6c", frame=True)

# Add the GMT logo in the Top Right (TR) corner of the current plot, scaled up to be 3
# centimeters wide and offset by 0.3 cm in x direction and 0.6 cm in y direction.
# centimeters wide and offset by 0.3 cm in x-direction and 0.6 cm in y-direction.
fig.logo(position="jTR+o0.3c/0.6c+w3c")

fig.show()
2 changes: 1 addition & 1 deletion examples/gallery/embellishments/legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

# Add a legend to the plot; place it within the plot bounding box with both
# reference ("J") and anchor ("+j") points being the Top Right (TR) corner and an
# offset of 0.2 centimeters in x and y directions; surround the legend with a box
# offset of 0.2 centimeters in x- and y-directions; surround the legend with a box
fig.legend(position="JTR+jTR+o0.2c", box=True)

# -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/embellishments/timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
The :meth:`pygmt.Figure.timestamp` method can draw the GMT timestamp logo on the plot.
The timestamp will always be shown relative to the Bottom Left (BL) corner of the plot.
By default, the ``offset`` and ``justify`` parameters are set to ``("-54p", "-54p")``
(x, y directions) and ``"BL"`` (Bottom Left), respectively.
(x-, y-directions) and ``"BL"`` (Bottom Left), respectively.
"""

# %%
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/histograms/blockm.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# Set the region for the plot
region = [130, 152.5, 32.5, 52.5]
# Define spacing in x and y direction (150x150 arc-minute blocks)
# Define spacing in x- and y-direction (150x150 arc-minute blocks)
spacing = "150m"

fig = pygmt.Figure()
Expand Down
4 changes: 2 additions & 2 deletions examples/gallery/histograms/scatter_and_histograms.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# level for all circles to deal with overplotting.
fig.plot(x=x, y=y, style="c0.15c", fill=fill, transparency=50)

# Shift the plot origin in y direction temporarily and add top margin histogram.
# Shift the plot origin in y-direction temporarily and add top margin histogram.
with fig.shift_origin(yshift=height + 0.25):
fig.histogram(
projection=f"X{width}/3",
Expand All @@ -56,7 +56,7 @@
series=0.2,
)

# Shift the plot origin in x direction temporarily and add right margin histogram.
# Shift the plot origin in x-direction temporarily and add right margin histogram.
with fig.shift_origin(xshift=width + 0.25):
# Plot the horizontal histogram.
fig.histogram(
Expand Down
4 changes: 2 additions & 2 deletions examples/gallery/images/cross_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# Add a colorbar for the elevation
fig.colorbar(
# Place the colorbar inside the plot (lowercase "j") in the Bottom Right (BR)
# corner with an offset ("+o") of 0.7 centimeters and 0.3 centimeters in x or y
# corner with an offset ("+o") of 0.7 centimeters and 0.3 centimeters in x- or y-
# directions, respectively; move the x label above the horizontal colorbar ("+ml")
position="jBR+o0.7c/0.8c+h+w5c/0.3c+ml",
# Add a box around the colobar with a fill ("+g") in "white" color and a
Expand All @@ -61,7 +61,7 @@
x=[126, 146],
y=[42, 40],
text=["A", "B"],
offset="0c/0.2c", # Move text 0.2 centimeters up (y direction)
offset="0c/0.2c", # Move text 0.2 centimeters up (y-direction)
font="15p", # Use a font size of 15 points
)

Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/images/grdclip.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
fig.grdimage(grid=grid, cmap="oleron")

# Shift plot origin of the second map by "width of the first map + 0.5 cm"
# in x direction
# in x-direction
fig.shift_origin(xshift="w+0.5c")

# Set all grid points < 0 m to a value of -2000 m.
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/images/grdlandmask.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Assign a value of 0 for all water masses and a value of 1 for all land
# masses.
# Use shoreline data with (l)ow resolution and set the grid spacing to
# 5 arc-minutes in x and y direction.
# 5 arc-minutes in x- and y-direction.
grid = pygmt.grdlandmask(region=region, spacing="5m", maskvalues=[0, 1], resolution="l")

# Plot clipped grid
Expand Down
3 changes: 2 additions & 1 deletion examples/gallery/lines/decorated_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
# Line with squares ("s") with a size of 0.7 centimeters in a distance of
# 1 centimeter
"~d1c:+ss0.7c+gtan+p1p,black",
# Shift symbols using "+n" in x and y directions relative to the main decorated line
# Shift symbols using "+n" in x- and y-directions relative to the main decorated
# line
"~d1c:+sd0.5c+gtan+p1p,black+n-0.2c/0.1c",
# Give the number of equally spaced symbols by using "n" instead of "d"
"~n6:+sn0.5c+gtan+p1p,black",
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/lines/envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
# Plot the data points on top
fig.plot(data=df_devi, style="c0.2c", pen="1p,gray30", fill="darkgray")

# Shift plot origin by the figure width ("w") plus 1 centimeter in x direction
# Shift plot origin by the figure width ("w") plus 1 centimeter in x-direction
fig.shift_origin(xshift="w+1c")

# -----------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions examples/gallery/lines/quoted_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"qN+1:+ltext",
# Adjust the justification of the labels via "+j", here Top Center
"qd1c:+ltext+jTC",
# Shift labels using "+n" in x and y directions relative to the main
# Shift labels using "+n" in x- and y-directions relative to the main
# quoted line
"qd1c:+ltext+n-0.5c/0.1c",
# Rotate labels via "+a" (counter-clockwise from horizontal)
Expand All @@ -54,7 +54,7 @@
"qd1c:+ltext+p0.5p,blue,dashed",
# Append "+o" to get a box with rounded edges
"qd1c:+ltext+p0.5p,blue+o",
# Adjust the space between label and box in x and y directions via "+c"
# Adjust the space between label and box in x- and y-directions via "+c"
"qd1c:+ltext+p0.5p,blue+o+c0.1c/0.1c",
# Give a fill of the box via "+g" together with the desired color
"qd1c:+ltext+gdodgerblue",
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/symbols/basic_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# upper row
y = 2

# use a dash in x direction (-) with a size of 0.9 cm,
# use a dash in x-direction (-) with a size of 0.9 cm,
# linewidth is set to 2p and the linecolor to "gray40"
fig.plot(x=1, y=y, style="-0.9c", pen="2p,gray40")
fig.text(x=1, y=y + 0.6, text="-", font=font)
Expand Down
2 changes: 1 addition & 1 deletion examples/intro/04_table_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- A table is a 2-D array with rows and columns. Each column represents a different
variable (e.g., *x*, *y* and *z*) and each row represents a different record.
- A grid is a 2-D array of data that is regularly spaced in the x and y directions (or
- A grid is a 2-D array of data that is regularly spaced in the x- and y-directions (or
longitude and latitude).

In this tutorial, we'll focus on working with table inputs, and cover grid inputs in a
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/advanced/legends.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# ``label`` parameter has to be specified to state the desired text for the legend entry
# (white spaces are supported). Here, we use :meth:`pygmt.Figure.plot`, exemplary. By
# default, the legend is placed in the Upper Right corner with an offset of 0.1
# centimeters in both x and y directions, and surrounded by a box with a white fill and
# centimeters in both x- and y-directions, and surrounded by a box with a white fill and
# a 1-point thick, black, solid outline. The order of the legend entries (top to bottom)
# is determine by the plotting order. Optionally, to adjust the legend, append different
# modifiers to the string passed to ``label``. For a list of available modifiers see
Expand Down
8 changes: 4 additions & 4 deletions examples/tutorials/basics/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
fig.plot(x=0, y=-3, style="s0.2c", fill="darkorange", pen="0.7p,darkgray")
fig.text(x=0, y=-3, text="my text")
# Shift the text label relatively to the position given via the x and y parameters
# by 1 centimeter to the right (positive x direction) and 0.5 centimeters down
# (negative y direction)
# by 1 centimeter to the right (positive x-direction) and 0.5 centimeters down
# (negative y-direction)
fig.text(x=0, y=-3, text="my text", offset="1c/-0.5c")

fig.shift_origin(xshift="w+0.5c")
Expand Down Expand Up @@ -102,7 +102,7 @@
#
# * ``fill``: Fills the text box with a color.
# * ``pen``: Outlines the text box.
# * ``clearance``: Adds margins in x and y directions between the text and the outline
# * ``clearance``: Adds margins in x-and y-directions between the text and the outline
# of the text box. Can be used to get a text box with rounded edges.

fig = pygmt.Figure()
Expand All @@ -116,7 +116,7 @@
fig.text(x=0, y=1, text="My text", pen="1p,seagreen,solid")

# Add margins between the text and the outline of the text box of 0.1
# centimeters in x direction and 0.2 centimeters in y direction
# centimeters in x-direction and 0.2 centimeters in y-direction
fig.text(x=0, y=-1, text="My text", pen="1p,seagreen,dashed", clearance="0.1c/0.2c")

# Get rounded edges by passing "+tO" to the "clearance" parameter
Expand Down
4 changes: 2 additions & 2 deletions pygmt/src/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def project(

Flat Earth (Cartesian) coordinate transformations can also be made. Set
``flat_earth=True`` and remember that azimuth is clockwise from North (the
y axis), NOT the usual cartesian theta, which is counterclockwise from the
x axis. azimuth = 90 - theta.
y-axis), NOT the usual cartesian theta, which is counterclockwise from the
x-axis. azimuth = 90 - theta.

No assumptions are made regarding the units for
:math:`x, y, r, s, p, q, dist, l_{{min}}, l_{{max}}, w_{{min}}, w_{{max}}`.
Expand Down
20 changes: 10 additions & 10 deletions pygmt/src/shift_origin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
shift_origin - Shift plot origin in x and/or y directions.
shift_origin - Shift plot origin in x- and/or y-directions.
"""

import contextlib
Expand All @@ -12,7 +12,7 @@ def shift_origin(
self, xshift: float | str | None = None, yshift: float | str | None = None
):
r"""
Shift the plot origin in x and/or y directions.
Shift the plot origin in x- and/or y-directions.

The shifts can be permanent or temporary. If used as a standalone method, the shifts
are permanent and apply to all subsequent plots. If used as a context manager, the
Expand All @@ -33,7 +33,7 @@ def shift_origin(
... # Other plot commands
...

The shifts *xshift* and *yshift* in x and y directions are relative to the current
The shifts *xshift* and *yshift* in x- and y-directions are relative to the current
plot origin. The default unit for shifts is centimeters (**c**) but can be changed
to other units via :gmt-term:`PROJ_LENGTH_UNIT`. Optionally, append the length unit
(**c** for centimeters, **i** for inches, or **p** for points) to the shifts.
Expand All @@ -59,9 +59,9 @@ def shift_origin(
Parameters
----------
xshift
Shift plot origin in x direction.
Shift plot origin in x-direction.
yshift
Shift plot origin in y direction.
Shift plot origin in y-direction.

Examples
--------
Expand All @@ -71,11 +71,11 @@ def shift_origin(
>>> import pygmt
>>> fig = pygmt.Figure()
>>> fig.basemap(region=[0, 5, 0, 5], projection="X5c/5c", frame=True)
>>> # Shift the plot origin in x direction by 6 cm
>>> # Shift the plot origin in x-direction by 6 cm
>>> fig.shift_origin(xshift=6)
<contextlib._GeneratorContextManager object at ...>
>>> fig.basemap(region=[0, 7, 0, 5], projection="X7c/5c", frame=True)
>>> # Shift the plot origin in x direction based on the previous plot width.
>>> # Shift the plot origin in x-direction based on the previous plot width.
>>> # Here, the width is 7 cm, and xshift is 8 cm.
>>> fig.shift_origin(xshift="w+1c")
<contextlib._GeneratorContextManager object at ...>
Expand All @@ -86,14 +86,14 @@ def shift_origin(

>>> fig = pygmt.Figure()
>>> fig.basemap(region=[0, 5, 0, 5], projection="X5c/5c", frame=True)
>>> # Shift the plot origin in x direction by 6 cm temporarily. The plot origin will
>>> # Shift the plot origin in x-direction by 6 cm temporarily. The plot origin will
>>> # revert back to the original plot origin after the block of code is executed.
>>> with fig.shift_origin(xshift=6):
... fig.basemap(region=[0, 5, 0, 5], projection="X5c/5c", frame=True)
>>> # Shift the plot origin in y direction by 6 cm temporarily.
>>> # Shift the plot origin in y-direction by 6 cm temporarily.
>>> with fig.shift_origin(yshift=6):
... fig.basemap(region=[0, 5, 0, 5], projection="X5c/5c", frame=True)
>>> # Shift the plot origin in x and y directions by 6 cm temporarily.
>>> # Shift the plot origin in x- and y-directions by 6 cm temporarily.
>>> with fig.shift_origin(xshift=6, yshift=6):
... fig.basemap(region=[0, 5, 0, 5], projection="X5c/5c", frame=True)
>>> fig.show()
Expand Down
Loading