code: def plotConvergenceByObject(results, objectRange, featureRange, numTrials,
                              linestyle='-'):
    
    ########################################################################
    #
    # Accumulate all the results per column in a convergence array.
    #
    # Convergence[f,o] = how long it took it to converge with f unique features
    # and o objects.
  
    convergence = numpy.zeros((max(featureRange), max(objectRange) + 1))
    for r in results:
      if r["numFeatures"] in featureRange:
        convergence[r["numFeatures"] - 1, r["numObjects"]] += r["convergencePoint"]
  
    convergence /= numTrials
  
    ########################################################################
    #
    # Create the plot. x-axis=
  
    # Plot each curve
    legendList = []
    colorList = ['r', 'b', 'g', 'm', 'c', 'k', 'y']
  
    for i in range(len(featureRange)):
      f = featureRange[i]
      print "features={} objectRange={} convergence={}".format(
        f,objectRange, convergence[f-1,objectRange])
      legendList.append('Unique features={}'.format(f))
      plt.plot(objectRange, convergence[f-1, objectRange],
               color=colorList[i], linestyle=linestyle)
  
    # format
    plt.legend(legendList, loc="lower right", 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("Number of touches to recognize one object (single column)")
docs: Plots the convergence graph: iterations vs number of objects.
    Each curve shows the convergence for a given number of unique features.