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

Deprecate xshift (X) and yshift (Y) aliases from all plotting modules (remove in v0.12.0) #2071

Merged
merged 35 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1b612e8
Update legend.py
michaelgrund Aug 20, 2022
0b10141
update
michaelgrund Aug 20, 2022
172714f
update remaining functions
michaelgrund Aug 20, 2022
e22c16c
add exemplary error message
michaelgrund Aug 20, 2022
fb53e50
format
michaelgrund Aug 20, 2022
3d4934c
remove xshift in 3d scatter plot example
michaelgrund Aug 21, 2022
e5364b8
remove XY from common options
michaelgrund Aug 21, 2022
e1df24d
update decorator
michaelgrund Aug 21, 2022
3505b6b
update
michaelgrund Aug 21, 2022
b53a574
Merge branch 'main' into remove-x-y-shift
michaelgrund Aug 29, 2022
5e76789
update if clause
michaelgrund Aug 29, 2022
25e097a
format
michaelgrund Aug 29, 2022
594ec3f
Merge branch 'main' into remove-x-y-shift
michaelgrund Sep 19, 2022
444071d
Apply suggestions from code review
michaelgrund Sep 25, 2022
e195e80
Merge branch 'main' into remove-x-y-shift
michaelgrund Sep 25, 2022
94dc0ae
add updates based on timestamp/U adjustments
michaelgrund Sep 25, 2022
acb01fe
format
michaelgrund Sep 25, 2022
54ec0b0
Merge branch 'main' into remove-x-y-shift
michaelgrund Oct 2, 2022
a11ea8b
Apply suggestions from code review
michaelgrund Nov 9, 2022
bb17675
Merge branch 'main' into remove-x-y-shift
michaelgrund Nov 9, 2022
31823e3
Update decorators.py
michaelgrund Nov 9, 2022
8d62ddd
Update ternary.py
michaelgrund Nov 11, 2022
0f6f626
Update decorators.py
michaelgrund Nov 11, 2022
fef1a49
Merge branch 'main' into remove-x-y-shift
michaelgrund Nov 11, 2022
bd2b05f
Update test_config.py
michaelgrund Nov 11, 2022
a167be3
[format-command] fixes
actions-bot Nov 11, 2022
b5329fd
Merge branch 'main' into remove-x-y-shift
michaelgrund Nov 16, 2022
27d0a70
add tests
michaelgrund Nov 16, 2022
256abfd
Update test_figure.py
michaelgrund Nov 16, 2022
e80797c
[format-command] fixes
actions-bot Nov 16, 2022
4ead194
Update test_figure.py
michaelgrund Nov 16, 2022
ea0e730
Apply suggestions from code review
michaelgrund Nov 19, 2022
18bbcc8
Merge branch 'main' into remove-x-y-shift
michaelgrund Nov 19, 2022
3e76319
[format-command] fixes
actions-bot Nov 19, 2022
691d81d
Merge branch 'main' into remove-x-y-shift
michaelgrund Nov 21, 2022
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: 3 additions & 1 deletion examples/gallery/3d_plots/scatter3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@
zscale=1.5,
)

# Shift plot origin in x direction
fig.shift_origin(xshift=3.1)
# Add colorbar legend
fig.colorbar(xshift=3.1)
fig.colorbar()

fig.show()
32 changes: 23 additions & 9 deletions pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,6 @@
"pen": """\
pen : str
Set pen attributes for lines or the outline of symbols.""",
"xyshift": r"""
xshift : str
[**a**\|\ **c**\|\ **f**\|\ **r**\][*xshift*].
Shift plot origin in x-direction.
yshift : str
[**a**\|\ **c**\|\ **f**\|\ **r**\][*yshift*].
Shift plot origin in y-direction. Full documentation is at
:gmt-docs:`gmt.html#xy-full`.
""",
"aspatial": r"""
aspatial : bool or str
[*col*\ =]\ *name*\ [,...].
Expand Down Expand Up @@ -577,6 +568,29 @@ def new_module(*args, **kwargs):
f"Use long-form parameter '{long_alias}' instead."
)
warnings.warn(msg, category=SyntaxWarning, stacklevel=2)

# xshift (X) is deprecated since v0.8.0.
if "X" in kwargs or "xshift" in kwargs:
if "xshift" in kwargs:
kwargs["X"] = kwargs.pop("xshift")
msg = (
"Parameters 'X' and 'xshift' are deprecated since v0.8.0 "
"and will be removed in v0.12.0. "
"Use Figure.shift_origin(xshift=...) instead."
)
warnings.warn(msg, category=SyntaxWarning, stacklevel=2)

# yshift (Y) is deprecated since v0.8.0.
if "Y" in kwargs or "yshift" in kwargs:
if "yshift" in kwargs:
kwargs["Y"] = kwargs.pop("yshift")
msg = (
"Parameters 'Y' and 'yshift' are deprecated since v0.8.0. "
"and will be removed in v0.12.0. "
"Use Figure.shift_origin(yshift=...) instead."
)
warnings.warn(msg, category=SyntaxWarning, stacklevel=2)

return module_func(*args, **kwargs)

new_module.aliases = aliases
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/basemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
Tm="compass",
U="timestamp",
V="verbose",
X="xshift",
Y="yshift",
c="panel",
f="coltypes",
p="perspective",
Expand Down Expand Up @@ -84,7 +82,6 @@ def basemap(self, **kwargs):
reference and anchor points
{timestamp}
{verbose}
{xyshift}
{panel}
{coltypes}
{perspective}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/coast.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
S="water",
U="timestamp",
V="verbose",
X="xshift",
Y="yshift",
c="panel",
p="perspective",
t="transparency",
Expand Down Expand Up @@ -177,7 +175,6 @@ def coast(self, **kwargs):
[Default is no fill]. Append **+l**\|\ **+L** to =\ *continent* to
only list countries in that continent; repeat if more than one
continent is requested.
{xyshift}
{panel}
{perspective}
{transparency}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
I="shading",
W="scale",
V="verbose",
X="xshift",
Y="yshift",
c="panel",
p="perspective",
t="transparency",
Expand Down Expand Up @@ -100,7 +98,6 @@ def colorbar(self, **kwargs):
asymmetric intensity range from *low* to *high*. [Default is no
illumination].
{verbose}
{xyshift}
{panel}
{perspective}
{transparency}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
U="timestamp",
V="verbose",
W="pen",
X="xshift",
Y="yshift",
b="binary",
c="panel",
d="nodata",
Expand Down Expand Up @@ -106,7 +104,6 @@ def contour(self, data=None, x=None, y=None, z=None, **kwargs):
separator for the two labels instead.
{timestamp}
{verbose}
{xyshift}
{binary}
{panel}
{nodata}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/grdcontour.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
V="verbose",
W="pen",
l="label",
X="xshift",
Y="yshift",
c="panel",
f="coltypes",
p="perspective",
Expand Down Expand Up @@ -85,7 +83,6 @@ def grdcontour(self, grid, **kwargs):
{timestamp}
{verbose}
{pen}
{xyshift}
{panel}
{coltypes}
label : str
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/grdimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
R="region",
U="timestamp",
V="verbose",
X="xshift",
Y="yshift",
n="interpolation",
c="panel",
f="coltypes",
Expand Down Expand Up @@ -156,7 +154,6 @@ def grdimage(self, grid, **kwargs):
3).
{region}
{verbose}
{xyshift}
{panel}
{coltypes}
{interpolation}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/grdview.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
Wf="facadepen",
I="shading",
V="verbose",
X="xshift",
Y="yshift",
c="panel",
f="coltypes",
n="interpolation",
Expand Down Expand Up @@ -114,7 +112,6 @@ def grdview(self, grid, **kwargs):
or just give **+d** to select the default arguments
[Default is **+a**\ -45\ **+nt**\ 1\ **+m**\ 0].
{verbose}
{xyshift}
{panel}
{coltypes}
{interpolation}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
U="timestamp",
V="verbose",
W="pen",
X="xshift",
Y="yshift",
Z="histtype",
b="binary",
c="panel",
Expand Down Expand Up @@ -124,7 +122,6 @@ def histogram(self, data, **kwargs):

To use weights provided as a second data column instead of pure counts,
append **+w**.
{xyshift}
{timestamp}
{verbose}
{binary}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
M="monochrome",
U="timestamp",
V="verbose",
X="xshift",
Y="yshift",
c="panel",
p="perspective",
t="transparency",
Expand Down Expand Up @@ -57,7 +55,6 @@ def image(self, imagefile, **kwargs):
YIQ-transformation.
{timestamp}
{verbose}
{xyshift}
{panel}
{perspective}
{transparency}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
F="box",
U="timestamp",
V="verbose",
X="xshift",
Y="yshift",
c="panel",
p="perspective",
t="transparency",
Expand Down Expand Up @@ -67,7 +65,6 @@ def legend(self, spec=None, position="JTR+jTR+o0.2c", box="+gwhite+p1p", **kwarg
1p black pen and adds a white background.
{timestamp}
{verbose}
{xyshift}
{panel}
{perspective}
{transparency}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
S="style",
U="timestamp",
V="verbose",
X="xshift",
Y="yshift",
c="panel",
t="transparency",
)
Expand Down Expand Up @@ -55,7 +53,6 @@ def logo(self, **kwargs):
- **u** to place the URL to the GMT site
{timestamp}
{verbose}
{xyshift}
{panel}
{transparency}
"""
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/meca.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ def data_format_code(convention, component="full"):
B="frame",
N="no_clip",
V="verbose",
X="xshift",
Y="yshift",
c="panel",
p="perspective",
t="transparency",
Expand Down Expand Up @@ -219,7 +217,6 @@ def meca(
{region}
{frame}
{verbose}
{xyshift}
{panel}
{perspective}
{transparency}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
U="timestamp",
V="verbose",
W="pen",
X="xshift",
Y="yshift",
Z="zvalue",
a="aspatial",
b="binary",
Expand Down Expand Up @@ -187,7 +185,6 @@ def plot(self, data=None, x=None, y=None, size=None, direction=None, **kwargs):
{pen}
{timestamp}
{verbose}
{xyshift}
zvalue : str
*value*\|\ *file*.
Instead of specifying a symbol or polygon fill and outline color
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/plot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
S="style",
V="verbose",
W="pen",
X="xshift",
Y="yshift",
Z="zvalue",
a="aspatial",
b="binary",
Expand Down Expand Up @@ -156,7 +154,6 @@ def plot3d(
{timestamp}
{verbose}
{pen}
{xyshift}
zvalue : str
*value*\|\ *file*.
Instead of specifying a symbol or polygon fill and outline color
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/rose.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
U="timestamp",
V="verbose",
W="pen",
X="xshift",
Y="yshift",
Z="scale",
b="binary",
d="nodata",
Expand Down Expand Up @@ -193,7 +191,6 @@ def rose(self, data=None, length=None, azimuth=None, **kwargs):

{timestamp}
{verbose}
{xyshift}
{binary}
{panel}
{nodata}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/solar.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
U="timestamp",
V="verbose",
W="pen",
X="xshift",
Y="yshift",
c="panel",
p="perspective",
t="transparency",
Expand Down Expand Up @@ -60,7 +58,6 @@ def solar(self, terminator="d", terminator_datetime=None, **kwargs):
Set pen attributes for lines [Default is ``"0.25p,black,solid"``].
{timestamp}
{verbose}
{xyshift}
{panel}
{perspective}
{transparency}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/subplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
SR="sharey",
T="title",
V="verbose",
X="xshift",
Y="yshift",
)
@kwargs_to_strings(Ff="sequence", Fs="sequence", M="sequence", R="sequence")
def subplot(self, nrows=1, ncols=1, **kwargs):
Expand Down Expand Up @@ -146,7 +144,6 @@ def subplot(self, nrows=1, ncols=1, **kwargs):
``frame``), the entire figure may also have an overarching *heading*
[no heading]. Font is determined by setting :gmt-term:`FONT_HEADING`.
{verbose}
{xyshift}
"""
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access

Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/ternary.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
U="timestamp",
V="verbose",
W="pen",
X="xshift",
Y="yshift",
c="panel",
p="perspective",
t="transparency",
Expand Down Expand Up @@ -66,7 +64,6 @@ def ternary(self, data, alabel=None, blabel=None, clabel=None, **kwargs):
*symbol*\[\ *size*].
Plot individual symbols in a ternary diagram.
{pen}
{xyshift}
{timestamp}
{verbose}
{panel}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
U="timestamp",
V="verbose",
W="pen",
X="xshift",
Y="yshift",
a="aspatial",
c="panel",
e="find",
Expand Down Expand Up @@ -151,7 +149,6 @@ def text_(
Do NOT clip text at map boundaries [Default is will clip].
{timestamp}
{verbose}
{xyshift}
{aspatial}
{panel}
{find}
Expand Down
3 changes: 0 additions & 3 deletions pygmt/src/velo.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
U="timestamp",
V="verbose",
W="pen",
X="xshift",
Y="yshift",
Z="zvalue",
c="panel",
d="nodata",
Expand Down Expand Up @@ -218,7 +216,6 @@ def velo(self, data=None, **kwargs):
updated from the CPT (see ``cmap``). If instead modifier **+cf** is
appended then the color from the cpt file is applied to symbol fill
only [Default]. Use just **+c** to set both pen and fill color.
{xyshift}
zvalue : str
[**m**\|\ **e**\|\ **n**\|\ **u**\ ][**+e**].
Select the quantity that will be used with the CPT given via ``cmap``
Expand Down
Loading