pygmt.src.ClipAccessor.dcw

ClipAccessor.dcw(code, **kwargs)[source]

Clip based on the Digital Chart of the World.

Must be used as a context manager. Any plotting operations within the context manager will be clipped to the region defined by the codes.

Parameters:
  • code (str | Sequence[str]) – The codes of the region to clip to.

  • kwargs – Additional keyword arguments passed to pygmt.Figure.coast. Not all parameters make sense in this context.

Examples

>>> from pygmt import Figure
>>> from pygmt.datasets import load_earth_relief
>>>
>>> grid = load_earth_relief()
>>> fig = Figure()
>>> fig.basemap(region="g", projection="W15c", frame=True)
>>> with fig.clip.dcw(code="JP"):
...     fig.grdimage(grid, cmap="geo")
>>> fig.show()