From efc86c72d36a30c878541f0620b5adab9de87279 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 22 Oct 2020 08:54:29 -0400 Subject: [PATCH 1/3] Add "no_clip" to plot, text, contour and meca --- pygmt/base_plotting.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/pygmt/base_plotting.py b/pygmt/base_plotting.py index 13cebbc8d20..832fd2a2854 100644 --- a/pygmt/base_plotting.py +++ b/pygmt/base_plotting.py @@ -603,6 +603,7 @@ def grdview(self, grid, **kwargs): B="frame", S="style", G="color", + N="no_clip", W="pen", i="columns", l="label", @@ -674,6 +675,18 @@ def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs): ``'[x|y|X|Y][+a][+cl|f][+n][+wcap][+ppen]'``. Draw symmetrical error bars. {G} + no_clip : bool or str + ``'[c|r]'`` + Do NOT clip symbols that fall outside map border [Default plots + points whose coordinates are strictly inside the map border only]. + The option does not apply to lines and polygons which are always + clipped to the map region. For periodic (360-longitude) maps we + must plot all symbols twice in case they are clipped by the + repeating boundary. ``no_clip=True`` will turn off clipping and not + plot repeating symbols. Use ``no_clip="r"`` to turn off clipping + but retain the plotting of such repeating symbols, or use + ``no_clip="c"`` to retain clipping but turn off plotting of + repeating symbols. style : str Plot symbols (including vectors, pie slices, fronts, decorated or quoted lines). @@ -738,6 +751,7 @@ def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs): G="label_placement", W="pen", L="triangular_mesh_pen", + N="no_clip", i="columns", l="label", C="levels", @@ -787,8 +801,9 @@ def contour(self, x=None, y=None, z=None, data=None, **kwargs): Color the triangles using CPT triangular_mesh_pen : str Pen to draw the underlying triangulation (default none) - N : bool - Do not clip contours + no_clip : bool + Do NOT clip contours or image at the boundaries [Default will clip + to fit inside region]. Q : float or str Do not draw contours with less than cut number of points. ``'[cut[unit]][+z]'`` @@ -1067,6 +1082,7 @@ def legend(self, spec=None, position="JTR+jTR+o0.2c", box="+gwhite+p1p", **kwarg C="clearance", D="offset", G="fill", + N="no_clip", W="pen", X="xshift", Y="yshift", @@ -1178,6 +1194,8 @@ def text( Sets the pen used to draw a rectangle around the text string (see *clearance*) [Default is width = default, color = black, style = solid]. + no_clip : bool + Do NOT clip text at map boundaries [Default will clip]. {XY} {p} {t} @@ -1235,6 +1253,7 @@ def text( J="projection", B="frame", C="offset", + N="no_clip", X="xshift", Y="yshift", p="perspective", @@ -1332,6 +1351,9 @@ def meca( circle is plotted at the initial location and a line connects the beachball to the circle. Specify pen and optionally append ``+ssize`` to change the line style and/or size of the circle. + no_clip : bool + Does NOT skip symbols that fall outside frame boundary specified by + *region* [Default plots symbols inside frame only]. {J} {R} {B} From 37b0664837331fa9bc519547a0e3123f4d9874d1 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 22 Oct 2020 19:30:38 -0400 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/base_plotting.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pygmt/base_plotting.py b/pygmt/base_plotting.py index 832fd2a2854..6450684bd39 100644 --- a/pygmt/base_plotting.py +++ b/pygmt/base_plotting.py @@ -676,7 +676,7 @@ def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs): Draw symmetrical error bars. {G} no_clip : bool or str - ``'[c|r]'`` + ``'[c|r]'``. Do NOT clip symbols that fall outside map border [Default plots points whose coordinates are strictly inside the map border only]. The option does not apply to lines and polygons which are always @@ -1195,7 +1195,7 @@ def text( (see *clearance*) [Default is width = default, color = black, style = solid]. no_clip : bool - Do NOT clip text at map boundaries [Default will clip]. + Do NOT clip text at map boundaries [Default is False, i.e. will clip]. {XY} {p} {t} @@ -1353,7 +1353,7 @@ def meca( ``+ssize`` to change the line style and/or size of the circle. no_clip : bool Does NOT skip symbols that fall outside frame boundary specified by - *region* [Default plots symbols inside frame only]. + *region* [Default is False, i.e. plot symbols inside map frame only]. {J} {R} {B} From 368d466d5a4eb7621de48c2a5e3f7a1e5fb4e95c Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 22 Oct 2020 20:09:38 -0400 Subject: [PATCH 3/3] Reformat docstrings --- pygmt/base_plotting.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pygmt/base_plotting.py b/pygmt/base_plotting.py index e253c0490bd..396b0c86d31 100644 --- a/pygmt/base_plotting.py +++ b/pygmt/base_plotting.py @@ -1214,7 +1214,8 @@ def text( (see *clearance*) [Default is width = default, color = black, style = solid]. no_clip : bool - Do NOT clip text at map boundaries [Default is False, i.e. will clip]. + Do NOT clip text at map boundaries [Default is False, i.e. will + clip]. {V} {XY} {p} @@ -1374,7 +1375,8 @@ def meca( ``+ssize`` to change the line style and/or size of the circle. no_clip : bool Does NOT skip symbols that fall outside frame boundary specified by - *region* [Default is False, i.e. plot symbols inside map frame only]. + *region* [Default is False, i.e. plot symbols inside map frame + only]. {J} {R} {B}