Skip to content

Commit 78a6205

Browse files
committed
Add plane (N) alias for grdview
Included test for setting a plain z-axis plane at a fixed height, and a test for colouring the frontal facade too.
1 parent bcffeb2 commit 78a6205

4 files changed

+31
-0
lines changed

pygmt/base_plotting.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ def grdimage(self, grid, **kwargs):
239239
Jz="zscale",
240240
JZ="zsize",
241241
C="cmap",
242+
N="plane",
242243
Q="surftype",
243244
p="perspective",
244245
)
@@ -266,6 +267,12 @@ def grdview(self, reliefgrid, **kwargs):
266267
cmap (C) : str
267268
The name of the color palette table to use.
268269
270+
plane (N) : float or str
271+
``level[+gfill]``.
272+
Draws a plane at this z-level. If the optional color is provided via the +g
273+
modifier, and the projection is not oblique, the frontal facade between the
274+
plane and the data perimeter is colored.
275+
269276
surftype (Q) : str
270277
Specifies cover type of the reliefgrid. Select one of following settings:
271278
1. 'm' for mesh plot [Default].
Loading
Loading

pygmt/tests/test_grdview.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,27 @@ def test_grdview_with_cmap_for_perspective_surface_plot(grid):
122122
zscale=0.005,
123123
)
124124
return fig
125+
126+
127+
@pytest.mark.mpl_image_compare
128+
def test_grdview_on_a_plane(grid):
129+
"""
130+
Run grdview by passing in a reliefgrid and plotting it on a z-plane, while settings
131+
a 3D perspective viewpoint.
132+
"""
133+
fig = Figure()
134+
fig.grdview(reliefgrid=grid, plane=-4000, perspective=[225, 30], zscale=0.005)
135+
return fig
136+
137+
138+
@pytest.mark.mpl_image_compare
139+
def test_grdview_on_a_plane_with_colored_frontal_facade(grid):
140+
"""
141+
Run grdview by passing in a reliefgrid and plotting it on a z-plane whose frontal
142+
facade is colored gray, while setting a 3D perspective viewpoint.
143+
"""
144+
fig = Figure()
145+
fig.grdview(
146+
reliefgrid=grid, plane="-4000+ggray", perspective=[225, 30], zscale=0.005
147+
)
148+
return fig

0 commit comments

Comments
 (0)