首页 > 解决方案 > Matplotlib 停止迭代异常

问题描述

我正在使用forJupyter-Lab 中的循环进行绘图。但是,在第 10 次情节之后,我不断收到StopIteration异常。知道为什么吗?

for i in range(0,14):
    plt.figure()
    plt.scatter(y=y, x=X[:,0], color=next(colors), marker='.', label="")
    plt.legend(loc='lower right')
    plt.title("")
    plt.xlabel("Feature")
    plt.ylabel("Response")
    plt.show() 

StopIteration: <Figure size 432x288 with 0 Axes>

标签: python-3.xmatplotlibjupyter-notebookscatter-plotjupyter-lab

解决方案


推荐阅读