Skip to content

Commit

Permalink
Add plane (N) alias for grdview
Browse files Browse the repository at this point in the history
Included test for setting a plain z-axis plane at a fixed height, and a test for colouring the frontal facade too.
  • Loading branch information
weiji14 committed Oct 4, 2019
1 parent bcffeb2 commit 78a6205
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pygmt/base_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def grdimage(self, grid, **kwargs):
Jz="zscale",
JZ="zsize",
C="cmap",
N="plane",
Q="surftype",
p="perspective",
)
Expand Down Expand Up @@ -266,6 +267,12 @@ def grdview(self, reliefgrid, **kwargs):
cmap (C) : str
The name of the color palette table to use.
plane (N) : float or str
``level[+gfill]``.
Draws a plane at this z-level. If the optional color is provided via the +g
modifier, and the projection is not oblique, the frontal facade between the
plane and the data perimeter is colored.
surftype (Q) : str
Specifies cover type of the reliefgrid. Select one of following settings:
1. 'm' for mesh plot [Default].
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions pygmt/tests/test_grdview.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,27 @@ def test_grdview_with_cmap_for_perspective_surface_plot(grid):
zscale=0.005,
)
return fig


@pytest.mark.mpl_image_compare
def test_grdview_on_a_plane(grid):
"""
Run grdview by passing in a reliefgrid and plotting it on a z-plane, while settings
a 3D perspective viewpoint.
"""
fig = Figure()
fig.grdview(reliefgrid=grid, plane=-4000, perspective=[225, 30], zscale=0.005)
return fig


@pytest.mark.mpl_image_compare
def test_grdview_on_a_plane_with_colored_frontal_facade(grid):
"""
Run grdview by passing in a reliefgrid and plotting it on a z-plane whose frontal
facade is colored gray, while setting a 3D perspective viewpoint.
"""
fig = Figure()
fig.grdview(
reliefgrid=grid, plane="-4000+ggray", perspective=[225, 30], zscale=0.005
)
return fig

0 comments on commit 78a6205

Please sign in to comment.