Skip to content

Commit

Permalink
Merge pull request #58 from pnnl/Fix_boolean_value_plot
Browse files Browse the repository at this point in the history
Fix boolean value plotting
  • Loading branch information
leijerry888 authored Nov 8, 2024
2 parents 34acb9b + 6c64ca5 commit 92650df
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 92650df

Please sign in to comment.