From 62119ff9dc3fad8dc87c970c069fb3c388f77325 Mon Sep 17 00:00:00 2001 From: Leander Kurscheidt Date: Fri, 10 Feb 2023 18:07:00 +0100 Subject: [PATCH] Clean Figure: Handle case if all data is nan --- src/tikzplotlib/_cleanfigure.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tikzplotlib/_cleanfigure.py b/src/tikzplotlib/_cleanfigure.py index 182a7455..47bdc6a0 100644 --- a/src/tikzplotlib/_cleanfigure.py +++ b/src/tikzplotlib/_cleanfigure.py @@ -486,6 +486,8 @@ def _remove_NaNs(data): :returns: data without NaNs """ id_nan = np.any(np.isnan(data), axis=1) + if np.all(id_nan): + return np.delete(data, np.arange(len(data)), axis=0) id_remove = np.argwhere(id_nan).reshape((-1,)) if _isempty(id_remove): pass