Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
4 changes: 2 additions & 2 deletions examples/tutorials/advanced/3d_perspective_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

# %%
# The ``perspective`` azimuth can be changed to set the direction that is "up"
# in the figure. The ``contourpen`` parameter sets the pen used to draw contour
# in the figure. The ``contour_pen`` parameter sets the pen used to draw contour
# lines on the surface. :meth:`pygmt.Figure.colorbar` can be used to add a
# color bar to the figure. The ``cmap`` parameter does not need to be passed
# again. To keep the color bar's alignment similar to the figure, use ``True``
Expand All @@ -92,7 +92,7 @@
cmap="geo",
plane="1000+ggrey",
# Set the contour pen thickness to "0.1p"
contourpen="0.1p",
contour_pen="0.1p",
)
fig.colorbar(perspective=True, frame=["a500", "x+lElevation", "y+lm"])
fig.show()
Expand Down
27 changes: 18 additions & 9 deletions pygmt/src/grdview.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,30 @@
from pygmt._typing import PathLike
from pygmt.alias import Alias, AliasSystem
from pygmt.clib import Session
from pygmt.helpers import build_arg_list, fmt_docstring, use_alias
from pygmt.helpers import build_arg_list, deprecate_parameter, fmt_docstring, use_alias

__doctest_skip__ = ["grdview"]


@fmt_docstring
@deprecate_parameter("contourpen", "contour_pen", "v0.18.0", remove_version="v0.20.0")
@deprecate_parameter("facadepen", "facade_pen", "v0.18.0", remove_version="v0.20.0")
@deprecate_parameter("meshpen", "mesh_pen", "v0.18.0", remove_version="v0.20.0")
@use_alias(
C="cmap",
G="drapegrid",
N="plane",
Q="surftype",
Wc="contourpen",
Wm="meshpen",
Wf="facadepen",
I="shading",
f="coltypes",
n="interpolation",
)
def grdview( # noqa: PLR0913
self,
grid: PathLike | xr.DataArray,
contour_pen: str | None = None,
facade_pen: str | None = None,
mesh_pen: str | None = None,
projection: str | None = None,
zscale: float | str | None = None,
zsize: float | str | None = None,
Expand Down Expand Up @@ -60,6 +63,9 @@ def grdview( # noqa: PLR0913
- JZ = zsize
- R = region
- V = verbose
- Wc = contour_pen
- Wf = facade_pen
- Wm = mesh_pen
- c = panel
- p = perspective
- t = transparency
Expand Down Expand Up @@ -101,15 +107,15 @@ def grdview( # noqa: PLR0913

For any of these choices, you may force a monochrome image by appending the
modifier **+m**.
contourpen : str
contour_pen
Draw contour lines on top of surface or mesh (not image). Append pen attributes
used for the contours.
meshpen : str
Set the pen attributes used for the mesh. You must also select ``surftype`` of
**m** or **sm** for meshlines to be drawn.
facadepen :str
facade_pen
Set the pen attributes used for the facade. You must also select ``plane`` for
the facade outline to be drawn.
mesh_pen
Set the pen attributes used for the mesh. You must also select ``surftype`` of
**m** or **sm** for meshlines to be drawn.
shading : str
Provide the name of a grid file with intensities in the (-1,+1) range, or a
constant intensity to apply everywhere (affects the ambient light).
Expand Down Expand Up @@ -162,6 +168,9 @@ def grdview( # noqa: PLR0913
aliasdict = AliasSystem(
Jz=Alias(zscale, name="zscale"),
JZ=Alias(zsize, name="zsize"),
Wc=Alias(contour_pen, name="contour_pen"),
Wf=Alias(facade_pen, name="facade_pen"),
Wm=Alias(mesh_pen, name="mesh_pen"),
).add_common(
B=frame,
J=projection,
Expand Down
6 changes: 3 additions & 3 deletions pygmt/tests/test_grdview.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def test_grdview_surface_plot_styled_with_contourpen(xrgrid):
surface plot.
"""
fig = Figure()
fig.grdview(grid=xrgrid, cmap="relief", surftype="s", contourpen="0.5p,black,dash")
fig.grdview(grid=xrgrid, cmap="relief", surftype="s", contour_pen="0.5p,black,dash")
Comment thread
seisman marked this conversation as resolved.
Outdated
return fig


Expand All @@ -190,7 +190,7 @@ def test_grdview_surface_mesh_plot_styled_with_meshpen(xrgrid):
mesh plot.
"""
fig = Figure()
fig.grdview(grid=xrgrid, cmap="relief", surftype="sm", meshpen="0.5p,black,dash")
fig.grdview(grid=xrgrid, cmap="relief", surftype="sm", mesh_pen="0.5p,black,dash")
Comment thread
seisman marked this conversation as resolved.
Outdated
return fig


Expand All @@ -206,7 +206,7 @@ def test_grdview_on_a_plane_styled_with_facadepen(xrgrid):
plane=100,
perspective=[225, 30],
zscale=0.005,
facadepen="0.5p,blue,dash",
facade_pen="0.5p,blue,dash",
Comment thread
seisman marked this conversation as resolved.
Outdated
)
return fig

Expand Down