Skip to content

Commit 89d993a

Browse files
committed
Allow for list of similar arrays
1 parent 8896be4 commit 89d993a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/extra/utils/misc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ def ridgeline_plot(data, *, overlap=0.5, xlabel=None, ylabel=None, stack_label=N
201201
import matplotlib.gridspec as grid_spec
202202
from matplotlib.transforms import blended_transform_factory
203203

204+
if isinstance(data, (list, tuple)):
205+
data = np.asarray(data)
204206
if data.ndim != 2:
205207
raise TypeError(f"Expected a 2D array (got {data.ndim}D)")
206208

@@ -213,7 +215,7 @@ def ridgeline_plot(data, *, overlap=0.5, xlabel=None, ylabel=None, stack_label=N
213215
stack_label = stack_label or data.dims[0]
214216
if stack_ticklabels is None and data.dims[0] in data.coords:
215217
stack_ticklabels = data.coords[data.dims[0]].values
216-
else:
218+
else: # Numpy array
217219
x_data = np.arange(data.shape[1])
218220

219221
x_range = x_data.min(), x_data.max()

0 commit comments

Comments
 (0)