|
13 | 13 | use_alias,
|
14 | 14 | )
|
15 | 15 |
|
| 16 | +__doctest_skip__ = ["grdview"] |
| 17 | + |
16 | 18 |
|
17 | 19 | @fmt_docstring
|
18 | 20 | @use_alias(
|
@@ -117,6 +119,39 @@ def grdview(self, grid, **kwargs):
|
117 | 119 | {interpolation}
|
118 | 120 | {perspective}
|
119 | 121 | {transparency}
|
| 122 | +
|
| 123 | + Example |
| 124 | + ------- |
| 125 | + >>> import pygmt |
| 126 | + >>> # load the 30 arc-minutes grid with "gridline" registration |
| 127 | + >>> # in a specified region |
| 128 | + >>> grid = pygmt.datasets.load_earth_relief( |
| 129 | + ... resolution="30m", |
| 130 | + ... region=[-92.5, -82.5, -3, 7], |
| 131 | + ... registration="gridline", |
| 132 | + ... ) |
| 133 | + >>> # create a new figure instance with pygmt.Figure() |
| 134 | + >>> fig = pygmt.Figure() |
| 135 | + >>> # create the contour plot |
| 136 | + >>> fig.grdview( |
| 137 | + ... # pass in the grid downloaded above |
| 138 | + ... grid=grid, |
| 139 | + ... # set the perspective to an azimuth of 130° and an elevation of 30° |
| 140 | + ... perspective=[130, 30], |
| 141 | + ... # add a frame to the x- and y-axes |
| 142 | + ... # specify annotations on the south and east borders of the plot |
| 143 | + ... frame=["xa", "ya", "wSnE"], |
| 144 | + ... # set the projection of the 2-D map to Mercator with a 10 cm width |
| 145 | + ... projection="M10c", |
| 146 | + ... # set the vertical scale (z-axis) to 2 cm |
| 147 | + ... zsize="2c", |
| 148 | + ... # set "surface plot" to color the surface via a CPT |
| 149 | + ... surftype="s", |
| 150 | + ... # specify CPT to "geo" |
| 151 | + ... cmap="geo", |
| 152 | + ... ) |
| 153 | + >>> # show the plot |
| 154 | + >>> fig.show() |
120 | 155 | """
|
121 | 156 | kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
|
122 | 157 | with Session() as lib:
|
|
0 commit comments