Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
931bfc1
Figure.clip: Initial implementation
seisman Mar 26, 2025
bb32777
Define more classes
seisman Apr 26, 2025
14a49b9
Merge branch 'main' into feature/clip
seisman May 1, 2025
430bb39
Merge branch 'main' into feature/clip
seisman May 3, 2025
5fc8871
Merge branch 'main' into feature/clip
seisman May 12, 2025
83f04fa
Improve docstrings
seisman May 12, 2025
ccf4d92
Update clip.land and clip.water
seisman May 12, 2025
1784795
Update clip.solar
seisman May 13, 2025
05bd0c0
Merge branch 'main' into feature/clip
seisman May 17, 2025
cc46add
Replace self._preprocess with self._activate_figure
seisman May 17, 2025
105c317
Add more aliases to clip
seisman May 19, 2025
a95d351
Add fmt_docstring
seisman May 19, 2025
3573bd7
Fix a doctest
seisman May 19, 2025
a9527ae
Fix docstring
seisman May 19, 2025
ca8dd43
Merge branch 'main' into feature/clip
seisman May 20, 2025
faaabb7
clip.polygon should accept a path or pandas object
seisman May 21, 2025
6cf4956
Move clip.dcw before clip.polygon
seisman May 22, 2025
88d198a
Merge branch 'main' into feature/clip
seisman May 24, 2025
f34a297
Merge branch 'main' into feature/clip
seisman May 25, 2025
a4955b9
Updates
seisman May 25, 2025
d8d33d0
Merge branch 'main' into feature/clip
seisman Sep 20, 2025
19bc113
Merge branch 'main' into feature/clip
seisman Sep 21, 2025
6d96b27
Merge branch 'main' into feature/clip
seisman Sep 24, 2025
f601459
Update to the new syntax
seisman Sep 24, 2025
5bcfaef
Merge branch 'main' into feature/clip
seisman Oct 10, 2025
06b08b1
Merge branch 'main' into feature/clip
seisman Jun 25, 2026
376284a
Remove unrelated changes
seisman Jun 25, 2026
a4363b8
Updates
seisman Jun 26, 2026
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
4 changes: 2 additions & 2 deletions doc/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
.. rubric:: Attributes

{% for item in attributes %}
.. autoattribute::
{{ objname }}.{{ item }}
.. autoattribute:: {{ objname }}.{{ item }}
:no-index:
{% endfor %}
{% endif %}

Expand Down
16 changes: 16 additions & 0 deletions doc/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ All plotting is handled through the :class:`pygmt.Figure` class and its methods.

Figure

Clipping
~~~~~~~~

Use :attr:`pygmt.Figure.clip` to define clipping paths within a ``with`` block.

.. autosummary::
:toctree: generated

Figure.clip
Figure.clip.land
Figure.clip.water
Figure.clip.dcw
Figure.clip.solar
Figure.clip.polygon
Figure.clip.mask

Plotting figure elements
~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
11 changes: 11 additions & 0 deletions pygmt/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from pygmt._typing import PathLike
from pygmt.src.basemap import basemap as _basemap
from pygmt.src.choropleth import choropleth as _choropleth
from pygmt.src.clip import ClipAccessor
from pygmt.src.coast import coast as _coast
from pygmt.src.colorbar import colorbar as _colorbar
from pygmt.src.contour import contour as _contour
Expand Down Expand Up @@ -164,6 +165,16 @@ def region(self) -> np.ndarray:
wesn = lib.extract_region()
return wesn

@property
def clip(self) -> ClipAccessor:
"""
Access clipping helpers for plotting inside or outside a path.

Use methods of this accessor as context managers, for example
``with fig.clip.land():``.
"""
return ClipAccessor(self)

def savefig(
self,
fname: PathLike,
Expand Down
1 change: 1 addition & 0 deletions pygmt/src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Figure plotting methods are attached in pygmt/figure.py and are not exported here.
from pygmt.src.binstats import binstats
from pygmt.src.blockm import blockmean, blockmedian, blockmode
from pygmt.src.clip import ClipAccessor
from pygmt.src.config import config
from pygmt.src.dimfilter import dimfilter
from pygmt.src.filter1d import filter1d
Expand Down
Loading
Loading