From this answer, I discovered how to reuse a plot.
This is the first plot
plot_depression, ax = plt.subplots()
ax=sns.lineplot(x="time",
y="value",
hue = "Group",
ci=90, err_style='bars',
data=df_long)
ax.set(xlabel = "Time", ylabel = "Result")
ax.set_title('Trajectory of depression during the pandemic', size=20)
This is the second plot
plot_anxiety, ax = plt.subplots()
ax=sns.lineplot(x="time",
y="value",
hue = "Group",
ci=90, err_style='bars',
data=df_long2)
ax.set(xlabel = "Time", ylabel = "Result")
ax.set_title('Trajectory of anxiety during the pandemic', size=20)
In any chunk, I can reuse these plots by calling plot_depression
or plot_anxiety
.
However, when I try to combine these two plots using this post, the result is two empty plots
fig, ax = plt.subplots(1, 2)
plot_anxiety
plot_depression
Any help is appreciated. If the full df is needed, I can edit this question.