Skip to content

Commit 617d955

Browse files
committed
Fix if too much data is given
1 parent 9733c53 commit 617d955

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pygmt/src/plot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
w="wrap",
5151
)
5252
@kwargs_to_strings(R="sequence", c="sequence_comma", i="sequence_comma", p="sequence")
53-
def plot(
53+
def plot( # noqa: PLR0912
5454
self,
5555
data=None,
5656
x=None,
@@ -262,6 +262,9 @@ def plot(
262262
kwargs["S"] = True
263263
data["symbol"] = symbol
264264
else:
265+
if any(v is not None for v in (x, y)):
266+
msg = "Too much data. Use either data or x/y/z."
267+
raise GMTInvalidInput(msg)
265268
for name, value in [
266269
("direction", direction),
267270
("fill", kwargs.get("G")),

pygmt/src/plot3d.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
w="wrap",
5252
)
5353
@kwargs_to_strings(R="sequence", c="sequence_comma", i="sequence_comma", p="sequence")
54-
def plot3d(
54+
def plot3d( # noqa: PLR0912
5555
self,
5656
data=None,
5757
x=None,
@@ -240,6 +240,10 @@ def plot3d(
240240
kwargs["S"] = True
241241
data["symbol"] = symbol
242242
else:
243+
if any(v is not None for v in (x, y)):
244+
msg = "Too much data. Use either data or x/y/z."
245+
raise GMTInvalidInput(msg)
246+
243247
for name, value in [
244248
("direction", direction),
245249
("fill", kwargs.get("G")),

0 commit comments

Comments
 (0)