Skip to content

Commit ffd8600

Browse files
Add inline example for grdimage (#2146)
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
1 parent 79b8812 commit ffd8600

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pygmt/src/grdimage.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use_alias,
1313
)
1414

15+
__doctest_skip__ = ["grdimage"]
16+
1517

1618
@fmt_docstring
1719
@use_alias(
@@ -161,6 +163,19 @@ def grdimage(self, grid, **kwargs):
161163
{perspective}
162164
{transparency}
163165
{cores}
166+
167+
Example
168+
-------
169+
>>> import pygmt
170+
>>> # load the 30 arc minute grid with "gridline" registration
171+
>>> grid = pygmt.datasets.load_earth_relief("30m", registration="gridline")
172+
>>> # create a new plot with pygmt.Figure()
173+
>>> fig = pygmt.Figure()
174+
>>> # pass in the grid and set the CPT to "geo"
175+
>>> # set the projection to Mollweide and the size to 10 cm
176+
>>> fig.grdimage(grid=grid, cmap="geo", projection="W10c", frame="ag")
177+
>>> # show the plot
178+
>>> fig.show()
164179
"""
165180
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
166181
with Session() as lib:

0 commit comments

Comments
 (0)