Only thing i could see is that you have to create your fig,axs
before targets
. Below shows that it works:
data = pd.DataFrame(np.random.uniform(0,1,(50,2)),columns=['num_items','mean'])
data['data_type'] = np.random.choice(['1','2','3','4'],50)
data['label'] = np.random.choice(['A','B'],50)
grouped = data.groupby('data_type')
grouped.groups.keys()
#this part
fig, axs = plt.subplots(figsize=(13,9),nrows=2, ncols=2)
targets = zip(grouped.groups.keys(), axs.flatten())
for i, (key, ax) in enumerate(targets):
sns.lineplot(data=grouped.get_group(key), ax=ax,
x="num_items", y="mean", hue="label", style="label")
ax.set_title('Insertion Performance: ' + str(key))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…