From 6c69f90f354e9a21800e28f5fb18da0923b34b15 Mon Sep 17 00:00:00 2001 From: Liam Toney <38269494+liamtoney@users.noreply.github.com> Date: Mon, 6 Jul 2020 23:45:05 -0600 Subject: [PATCH 1/7] Add shading to grdview gallery example --- examples/gallery/grid/grdview_surface.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/gallery/grid/grdview_surface.py b/examples/gallery/grid/grdview_surface.py index 01ec7f08746..45268552575 100644 --- a/examples/gallery/grid/grdview_surface.py +++ b/examples/gallery/grid/grdview_surface.py @@ -8,7 +8,8 @@ elevation angle of the view. We provide a list of two arguments to ``frame`` — the second argument, prepended with ``"z"``, specifies the :math:`z`-axis frame attributes. Specifying the same scale for the ``projection`` and ``zcale`` arguments ensures equal -axis scaling. +axis scaling. The ``I`` argument specifies illumination; here we choose an azimuth of 45° +with ``I="+a45"``. """ import pygmt @@ -45,6 +46,7 @@ def ackley(x, y): surftype="s", cmap="roma", perspective="135/30", + I="+a45", ) fig.show() From af97d7f10cbb9b18fe26550e5c9999aa02c60987 Mon Sep 17 00:00:00 2001 From: Liam Toney <38269494+liamtoney@users.noreply.github.com> Date: Sat, 11 Jul 2020 23:15:04 -0600 Subject: [PATCH 2/7] Add long form argument for shading --- pygmt/base_plotting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pygmt/base_plotting.py b/pygmt/base_plotting.py index 4f1bfd7507a..9f444a78058 100644 --- a/pygmt/base_plotting.py +++ b/pygmt/base_plotting.py @@ -336,6 +336,7 @@ def grdimage(self, grid, **kwargs): Wm="meshpen", Wf="facadepen", p="perspective", + I="shading", ) @kwargs_to_strings(R="sequence", p="sequence") def grdview(self, grid, **kwargs): From 522c10cb06a09a11ac3dba18092c8ee9575d8fc5 Mon Sep 17 00:00:00 2001 From: Liam Toney Date: Sat, 11 Jul 2020 23:18:32 -0600 Subject: [PATCH 3/7] Update example for long form args --- examples/gallery/grid/grdview_surface.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/gallery/grid/grdview_surface.py b/examples/gallery/grid/grdview_surface.py index 45268552575..b9fafd6d066 100644 --- a/examples/gallery/grid/grdview_surface.py +++ b/examples/gallery/grid/grdview_surface.py @@ -8,8 +8,8 @@ elevation angle of the view. We provide a list of two arguments to ``frame`` — the second argument, prepended with ``"z"``, specifies the :math:`z`-axis frame attributes. Specifying the same scale for the ``projection`` and ``zcale`` arguments ensures equal -axis scaling. The ``I`` argument specifies illumination; here we choose an azimuth of 45° -with ``I="+a45"``. +axis scaling. The ``shading`` argument specifies illumination; here we choose an azimuth of +45° with ``shading="+a45"``. """ import pygmt @@ -46,7 +46,7 @@ def ackley(x, y): surftype="s", cmap="roma", perspective="135/30", - I="+a45", + shading="+a45", ) fig.show() From f52001ca092a0cdf3289820a9d9bff9ef161d12f Mon Sep 17 00:00:00 2001 From: Liam Toney <38269494+liamtoney@users.noreply.github.com> Date: Sat, 11 Jul 2020 23:47:19 -0600 Subject: [PATCH 4/7] Add parameter description for shading --- pygmt/base_plotting.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pygmt/base_plotting.py b/pygmt/base_plotting.py index 9f444a78058..58f4e8f4816 100644 --- a/pygmt/base_plotting.py +++ b/pygmt/base_plotting.py @@ -403,6 +403,15 @@ def grdview(self, grid, **kwargs): perspective : list or str ``'[x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]'``. Select perspective view. + + 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). Alternatively, derive an intensity grid from the + input data grid reliefgrid via a call to ``grdgradient``; append + ``+aazimuth``, ``+nargs``, and ``+mambient`` to specify azimuth, + intensity, and ambient arguments for that module, or just give + ``+d`` to select the default arguments (``+a-45+nt1+m0``). """ kwargs = self._preprocess(**kwargs) From bb59650b2f0fe9836c56c1fd85ecfdb7715bb07d Mon Sep 17 00:00:00 2001 From: Liam Toney <38269494+liamtoney@users.noreply.github.com> Date: Sat, 11 Jul 2020 23:49:57 -0600 Subject: [PATCH 5/7] Remove whitespace on blank line --- pygmt/base_plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/base_plotting.py b/pygmt/base_plotting.py index 58f4e8f4816..a9ca7dd26b8 100644 --- a/pygmt/base_plotting.py +++ b/pygmt/base_plotting.py @@ -403,7 +403,7 @@ def grdview(self, grid, **kwargs): perspective : list or str ``'[x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]'``. Select perspective view. - + 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 From 716d91ffbae037d320aaa74266fb7e3ef1848e61 Mon Sep 17 00:00:00 2001 From: Liam Toney <38269494+liamtoney@users.noreply.github.com> Date: Sun, 12 Jul 2020 16:39:54 -0600 Subject: [PATCH 6/7] Update examples/gallery/grid/grdview_surface.py Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- examples/gallery/grid/grdview_surface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/grid/grdview_surface.py b/examples/gallery/grid/grdview_surface.py index b9fafd6d066..f160cdd038a 100644 --- a/examples/gallery/grid/grdview_surface.py +++ b/examples/gallery/grid/grdview_surface.py @@ -45,7 +45,7 @@ def ackley(x, y): zscale=f"{SCALE}i", surftype="s", cmap="roma", - perspective="135/30", + perspective=[135, 30], # Azimuth SouthEast (135°), at Elevation 30° shading="+a45", ) From 3945d6ca89897023168bb08830f31e55cd5a14b5 Mon Sep 17 00:00:00 2001 From: Liam Toney <38269494+liamtoney@users.noreply.github.com> Date: Sun, 12 Jul 2020 16:41:10 -0600 Subject: [PATCH 7/7] Change case in comment --- examples/gallery/grid/grdview_surface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/grid/grdview_surface.py b/examples/gallery/grid/grdview_surface.py index f160cdd038a..64114d60f32 100644 --- a/examples/gallery/grid/grdview_surface.py +++ b/examples/gallery/grid/grdview_surface.py @@ -45,7 +45,7 @@ def ackley(x, y): zscale=f"{SCALE}i", surftype="s", cmap="roma", - perspective=[135, 30], # Azimuth SouthEast (135°), at Elevation 30° + perspective=[135, 30], # Azimuth southeast (135°), at elevation 30° shading="+a45", )