in
5 cmap_names = list(all_cmap_dict.keys())
6
----> 7 for idx, ax in enumerate(axs['pitch'].flat):
8 print(idx)
9 cmap_name = f'cmr.{cmap_names[idx]}'
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
pitch = VerticalPitch(line_color='#cfcfcf', line_zorder=2, pitch_color='#122c3d') fig, axs = pitch.grid(nrows=11, ncols=4, space=0.1, figheight=40, title_height=0, endnote_height=0, # no title/ endnote grid_width=0.9, grid_height=0.98, bottom=0.01, left=0.05) cmap_names = list(all_cmap_dict.keys())
for idx, ax in enumerate(axs['pitch'].flat): print(idx) cmap_name = f'cmr.{cmap_names[idx]}' cmap = all_cmap_dict[cmap_names[idx]] kdeplot = pitch.kdeplot(r_df.x, r_df.y, ax=ax, cmap=cmap, shade=True, levels=100) ax.set_title(cmap_name, fontsize=15)
Output : --------------------------------------------------------------------------- IndexError Traceback (most recent call last)