Win-stay / lose-switch by session, day or mouse#

A point per session of one day, per day of training, or per mouse: the same function, split another way.

from matplotlib import pyplot as plt

from lecilab_behavior_analysis.metrics.choices import get_win_stay_lose_switch_df
from lecilab_behavior_analysis.plots import win_stay_lose_switch_plot

fig, (by_session, by_day, by_mouse) = plt.subplots(1, 3, figsize=(16, 4.2))
win_stay_lose_switch_plot(get_win_stay_lose_switch_df(day, by="session"), hue="session", ax=by_session)
by_session.set_title("Sessions of one day")
days = get_win_stay_lose_switch_df(trials, by="year_month_day")
win_stay_lose_switch_plot(days, hue="year_month_day", ax=by_day)  # many days: from dark to yellow
by_day.set_title("Days of one mouse")
win_stay_lose_switch_plot(get_win_stay_lose_switch_df(cohort, by="subject"), hue="subject", ax=by_mouse)
by_mouse.set_title("Mice")
fig.tight_layout()

trials, day, summary, events and cohort are the inputs of the examples. Back to the gallery