I am making plots in a loop:
plotData.sort_values(by=['segment'])
for date in plotData.month_of_default.unique():
plt.figure()
temp =plotData[plotData.month_of_default==date][['New_Amount_2','ID','segment','total','payment','month']]
denom = temp.drop_duplicates(subset=['ID']).groupby('segment')['total'].sum()
test = temp.groupby(['segment','month']).New_Amount_2.sum().groupby(level=0).cumsum()/denom
plt.plot(test.unstack().T)
I've tried putting title='' in the plt.plot() brackets and in plt.figure(), also adding fig.subtitle('Title', fontsize=16) and neither worked - what's the right syntax to do this? Thanks! :)