Skip to content

Commit

Permalink
improved: plot_events_bars accepts hue=None
Browse files Browse the repository at this point in the history
  • Loading branch information
alondmnt committed Sep 3, 2024
1 parent a0ddbdb commit dd4425e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nbs/15_timeseries_plots.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@
" participant_id, array_index, time_range,\n",
" y_include, y_exclude,\n",
" palette=palette)\n",
" if hue is None:\n",
" hue = 'hue'\n",
"\n",
" if ax is None:\n",
" fig, ax = plt.subplots(figsize=figsize)\n",
Expand Down Expand Up @@ -606,6 +608,8 @@
" participant_id, array_index, time_range,\n",
" y_include, y_exclude,\n",
" palette=palette)\n",
" if hue is None:\n",
" hue = 'hue'\n",
"\n",
" if ax is None:\n",
" fig, ax = plt.subplots(figsize=figsize)\n",
Expand Down Expand Up @@ -706,6 +710,9 @@
" if label is not None:\n",
" ind |= events[label].isin(y_exclude)\n",
" events = events.loc[~ind]\n",
" if hue is None:\n",
" hue = 'hue'\n",
" events[hue] = 'events'\n",
"\n",
" col_list = [x_start, x_end, hue, label]\n",
" if add_columns is not None:\n",
Expand Down
7 changes: 7 additions & 0 deletions pheno_utils/timeseries_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,8 @@ def plot_events_bars(
participant_id, array_index, time_range,
y_include, y_exclude,
palette=palette)
if hue is None:
hue = 'hue'

if ax is None:
fig, ax = plt.subplots(figsize=figsize)
Expand Down Expand Up @@ -560,6 +562,8 @@ def plot_events_fill(
participant_id, array_index, time_range,
y_include, y_exclude,
palette=palette)
if hue is None:
hue = 'hue'

if ax is None:
fig, ax = plt.subplots(figsize=figsize)
Expand Down Expand Up @@ -660,6 +664,9 @@ def prepare_events(
if label is not None:
ind |= events[label].isin(y_exclude)
events = events.loc[~ind]
if hue is None:
hue = 'hue'
events[hue] = 'events'

col_list = [x_start, x_end, hue, label]
if add_columns is not None:
Expand Down

0 comments on commit dd4425e

Please sign in to comment.