Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inline example for grdimage #2146

Merged
merged 5 commits into from
Oct 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pygmt/src/grdimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use_alias,
)

__doctest_skip__ = ["grdimage"]


@fmt_docstring
@use_alias(
Expand Down Expand Up @@ -161,6 +163,19 @@ def grdimage(self, grid, **kwargs):
{perspective}
{transparency}
{cores}

Example
-------
>>> import pygmt
>>> # load the 30 arc minute grid with "gridline" registration
>>> grid = pygmt.datasets.load_earth_relief("30m", registration="gridline")
>>> # create a new plot with pygmt.Figure()
>>> fig = pygmt.Figure()
>>> # pass in the grid and set the CPT to "geo"
>>> # set the projection to Mollweide and the size to 10 cm
>>> fig.grdimage(grid=grid, cmap="geo", projection="W10c", frame="ag")
>>> # show the plot
>>> fig.show()
"""
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
with Session() as lib:
Expand Down