ValueError: num must be 1 <= num <= 2, not 3

北慕城南 提交于 2019-12-05 01:40:55

Note that you only generate two subplots:

ax = plt.subplot(1,2,i+1)

The first argument is the number of plots in each row and the second the number of plots per column (see also the matplotlib.pyplot.subplot documentation). So the total number of plots avaiable in your case is: 1*2 = 2. If you want to create 25 you could for example use:

ax = plt.subplot(5,5,i+1)

5 plots per row and 5 per column add to a total number of 5*5 = 25

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!