Skip to content

Commit

Permalink
Fix boolean value plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
yunjoonjung-PNNL committed Nov 8, 2024
1 parent 34acb9b commit 6c64ca5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions constrain/checklib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6c64ca5

Please sign in to comment.