From 6c64ca5f4706ec0829d661292199eda30b0a0bcd Mon Sep 17 00:00:00 2001 From: yunjoonjung Date: Thu, 7 Nov 2024 23:52:07 -0800 Subject: [PATCH] Fix boolean value plotting --- constrain/checklib.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/constrain/checklib.py b/constrain/checklib.py index ba731f5..abbf862 100644 --- a/constrain/checklib.py +++ b/constrain/checklib.py @@ -213,6 +213,9 @@ def all_plot_obo(self, plt_pts, fig_size): if pt_nan[pt]: self.df[pt].plot(ax=axx, marker=".") else: + # check if values in the series are boolean + if self.df[pt].apply(lambda x: isinstance(x, bool)).all(): + self.df[pt] = self.df[pt].astype(int) self.df[pt].plot(ax=axx) plt.title(f"All samples - {pt} - {self.__class__.__name__}") i += 1 @@ -326,6 +329,9 @@ def day_plot_obo(self, plt_pts, fig_size): if pt_nan[pt]: plotdaydf[pt].plot(ax=axx, marker=".") else: + # check if values in the series are boolean + if self.df[pt].apply(lambda x: isinstance(x, bool)).all(): + self.df[pt] = self.df[pt].astype(int) plotdaydf[pt].plot(ax=axx) plt.title(f"Example day - {pt} - {self.__class__.__name__}") i += 1