in svg/analysis.py [0:0]
def plot_agg(df, agg, ncol=4):
nrow = int(np.ceil(len(agg)/ncol))
fig, axs = plt.subplots(nrow, ncol, figsize=(6*ncol, 4*nrow))
if nrow == 1 and ncol == 1:
axs = [axs]
else:
axs = axs.ravel()
for ax, (r, sub_df) in zip(axs, agg.iterrows()):
if isinstance(r, str):
r = [r]
I = df.index == df.index
for k, v in zip(agg.index.names, r):
I = I & (df[k] == v)
df_I = df[I]
title = '.'.join([f'{k}={v}' for k,v in zip(agg.index.names, r)])
title = title.replace('agent.params.', '').replace('model.params.', '')
title = '\n'.join(textwrap.wrap(title, 45))
plot_rew_list(df_I.d.values, title=title, ax=ax)
fig.tight_layout()