From 3aaccd902d9dd5ae5a965ab5ee97c11ffb813401 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 19 Sep 2021 11:30:44 +0800 Subject: [PATCH] Allow non-string color when input data is a matrix or a file for plot and plot3d --- pygmt/src/plot.py | 2 +- pygmt/src/plot3d.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/src/plot.py b/pygmt/src/plot.py index 024d71b5ea8..9076339dccf 100644 --- a/pygmt/src/plot.py +++ b/pygmt/src/plot.py @@ -239,7 +239,7 @@ def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs): kwargs["S"] = "s0.2c" except FileNotFoundError: pass - if "G" in kwargs and not isinstance(kwargs["G"], str): + if "G" in kwargs and is_nonstr_iter(kwargs["G"]): if kind != "vectors": raise GMTInvalidInput( "Can't use arrays for color if data is matrix or file." diff --git a/pygmt/src/plot3d.py b/pygmt/src/plot3d.py index 89aadd62618..afaf70ff6fc 100644 --- a/pygmt/src/plot3d.py +++ b/pygmt/src/plot3d.py @@ -209,7 +209,7 @@ def plot3d( kwargs["S"] = "u0.2c" except FileNotFoundError: pass - if "G" in kwargs and not isinstance(kwargs["G"], str): + if "G" in kwargs and is_nonstr_iter(kwargs["G"]): if kind != "vectors": raise GMTInvalidInput( "Can't use arrays for color if data is matrix or file."