code: def plotConvergenceByObjectMultiColumn(results, objectRange, columnRange):
    
    ########################################################################
    #
    # Accumulate all the results per column in a convergence array.
    #
    # Convergence[c,o] = how long it took it to converge with f unique features
    # and c columns.
  
    convergence = numpy.zeros((max(columnRange), max(objectRange) + 1))
    for r in results:
      if r["numColumns"] in columnRange:
        convergence[r["numColumns"] - 1, r["numObjects"]] += r["convergencePoint"]
  
    convergence /= numTrials
  
    # print "Average convergence array=", convergence
  
    ########################################################################
    #
    # Create the plot. x-axis=
    plt.figure()
    plotPath = os.path.join("plots", "convergence_by_object_multicolumn.jpg")
  
    # Plot each curve
    legendList = []
    colorList = ['r', 'b', 'g', 'm', 'c', 'k', 'y']
  
    for i in range(len(columnRange)):
      c = columnRange[i]
      print "columns={} objectRange={} convergence={}".format(
        c, objectRange, convergence[c-1,objectRange])
      if c == 1:
        legendList.append('1 column')
      else:
        legendList.append('{} columns'.format(c))
      plt.plot(objectRange, convergence[c-1,objectRange],
               color=colorList[i])
  
    # format
    plt.legend(legendList, loc="upper left", prop={'size':10})
    plt.xlabel("Number of objects in training set")
    plt.xticks(range(0,max(objectRange)+1,10))
    plt.yticks(range(0,int(convergence.max())+2))
    plt.ylabel("Average number of touches")
    plt.title("Object recognition with multiple columns (unique features = 5)")
  
      # save
    plt.savefig(plotPath)
    plt.close()
docs: Plots the convergence graph: iterations vs number of objects.
    Each curve shows the convergence for a given number of columns.