diff --git a/examples/tutorials/advanced/3d_perspective_image.py b/examples/tutorials/advanced/3d_perspective_image.py index c1c3bba36f9..5bef9b37a96 100644 --- a/examples/tutorials/advanced/3d_perspective_image.py +++ b/examples/tutorials/advanced/3d_perspective_image.py @@ -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`` @@ -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() diff --git a/pygmt/src/grdview.py b/pygmt/src/grdview.py index 06b5ef1ab55..90bc13f12b2 100644 --- a/pygmt/src/grdview.py +++ b/pygmt/src/grdview.py @@ -9,20 +9,20 @@ 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", @@ -30,6 +30,9 @@ 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, @@ -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 @@ -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). @@ -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, diff --git a/pygmt/tests/test_grdview.py b/pygmt/tests/test_grdview.py index 40c40190d21..a1e8fd6735f 100644 --- a/pygmt/tests/test_grdview.py +++ b/pygmt/tests/test_grdview.py @@ -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,dashed") return fig @@ -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,dashed") return fig @@ -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,dashed", ) return fig