@@ -228,14 +228,41 @@ def dcw(self, code: str | Sequence[str], **kwargs):
228
228
_code = "," .join (code ) if is_nonstr_iter (code ) else code
229
229
return _ClipDcw (self ._figure , dcw = f"{ _code } +c" , ** kwargs )
230
230
231
+ def solar (self , ** kwargs ):
232
+ """
233
+ Clip the data to the solar terminator.
234
+
235
+ Must be used as a context manager. Any plotting operations within the context
236
+ manager will be clipped to the solar terminator.
237
+
238
+ Parameters
239
+ ----------
240
+ kwargs
241
+ Additional keyword arguments passed to :meth:`pygmt.Figure.solar`. Not all
242
+ parameters make sense in this context.
243
+
244
+ Examples
245
+ --------
246
+ >>> from pygmt import Figure
247
+ >>> from pygmt.datasets import load_earth_relief
248
+ >>>
249
+ >>> grid = load_earth_relief()
250
+ >>> fig = Figure()
251
+ >>> fig.basemap(region="g", projection="W15c", frame=True)
252
+ >>> with fig.clip.solar(terminator="civil"):
253
+ ... fig.grdimage(grid, cmap="geo")
254
+ >>> fig.show()
255
+ """
256
+ return _ClipSolar (self ._figure , ** kwargs )
257
+
231
258
@fmt_docstring
232
259
@use_alias (
233
260
A = "straight_line" ,
234
261
B = "frame" ,
235
- R = "region" ,
236
262
J = "projection" ,
237
- V = "verbose" ,
238
263
N = "invert" ,
264
+ R = "region" ,
265
+ V = "verbose" ,
239
266
W = "pen" ,
240
267
)
241
268
@kwargs_to_strings (R = "sequence" )
@@ -251,9 +278,9 @@ def polygon(self, data=None, x=None, y=None, **kwargs):
251
278
Parameters
252
279
----------
253
280
data
254
- Coordinates of polygon .
281
+ Either a file name to an ASCII data table, a 2-D {table-classes} .
255
282
x/y
256
- Coordinates of polygon.
283
+ X and Y coordinates of the polygon.
257
284
{frame}
258
285
{region}
259
286
{projection}
@@ -304,39 +331,29 @@ def polygon(self, data=None, x=None, y=None, **kwargs):
304
331
"""
305
332
return _ClipPolygon (self ._figure , data = data , x = x , y = y , ** kwargs )
306
333
307
- def solar (self , ** kwargs ):
334
+ @fmt_docstring
335
+ @use_alias (
336
+ I = "spacing" ,
337
+ N = "invert" ,
338
+ S = "radius" ,
339
+ )
340
+ @kwargs_to_strings (R = "sequence" )
341
+ def mask (self , data = None , x = None , y = None , ** kwargs ):
308
342
"""
309
- Clip the data to the solar terminator .
343
+ Clip the data to a mask .
310
344
311
345
Must be used as a context manager. Any plotting operations within the context
312
- manager will be clipped to the solar terminator .
346
+ manager will be clipped to the mask .
313
347
314
348
Parameters
315
349
----------
316
- kwargs
317
- Additional keyword arguments passed to :meth:`pygmt.Figure.solar`. Not all
318
- parameters make sense in this context.
319
-
320
- Examples
321
- --------
322
- >>> from pygmt import Figure
323
- >>> from pygmt.datasets import load_earth_relief
324
- >>>
325
- >>> grid = load_earth_relief()
326
- >>> fig = Figure()
327
- >>> fig.basemap(region="g", projection="W15c", frame=True)
328
- >>> with fig.clip.solar(terminator="civil"):
329
- ... fig.grdimage(grid, cmap="geo")
330
- >>> fig.show()
331
- """
332
- return _ClipSolar (self ._figure , ** kwargs )
333
-
334
- def mask (self , x , y , spacing , radius = None ):
335
- """
336
- Clip the data to a mask.
337
-
338
- Must be used as a context manager. Any plotting operations within the context
339
- manager will be clipped to the mask.
350
+ data
351
+ Either a file name to an ASCII data table, a 2-D {table-classes}.
352
+ x/y
353
+ X and Y coordinates of the mask.
354
+ {spacing}
355
+ invert
356
+ Invert the sense of what is inside and outside.
340
357
341
358
Examples
342
359
--------
@@ -353,4 +370,4 @@ def mask(self, x, y, spacing, radius=None):
353
370
... fig.grdimage(grid, cmap="geo")
354
371
>>> fig.show()
355
372
"""
356
- return _ClipMask (self ._figure , data = { "x" : x , "y" : y }, I = spacing , S = radius )
373
+ return _ClipMask (self ._figure , data = data , x = x , y = y , ** kwargs )
0 commit comments