def stats(path, options): output = loadItems(path, options) itemsCount = len(output.items) if itemsCount > 0: print("Found " + str(itemsCount) + " entries") print("") #display statistics printStats(output) #display graph import plotStyle i = 0 for someItems in output.stats.values(): clr = plotStyle.tableau20[i % len(plotStyle.tableau20)] plt.plot(someItems, '-', color=clr) i += 1 plotStyle.subplotStyle(plt.subplot(111)) plotStyle.style(plt) if options.show: plt.show() else: plt.savefig("out.png", bbox_inches="tight") else: print("No entries were found")
largestTilePerStragegy = [] for strategiesStat in strategiesStats: strategyName, stats = strategiesStat mean = numpy.mean(stats, axis=0) moves, score, largestTile = mean namesPerStrategy.append(strategyName) movesPerStrategy.append(moves) scorePerStrategy.append(score) largestTilePerStragegy.append(largestTile) xses = numpy.arange(len(movesPerStrategy)) plotStyle.subplotStyle(plt.subplot(131)) plt.title('Moves') plt.bar(xses, movesPerStrategy, color=plotStyle.tableau20, tick_label=namesPerStrategy, align="center") plotStyle.subplotStyle(plt.subplot(132)) plt.title('Score') plt.bar(xses, scorePerStrategy, color=plotStyle.tableau20, tick_label=namesPerStrategy, align="center") plotStyle.subplotStyle(plt.subplot(133)) plt.title('Largest tile') plt.bar(xses, largestTilePerStragegy, color=plotStyle.tableau20, tick_label=namesPerStrategy, align="center") plotStyle.style(plt) try: mng = plt.get_current_fig_manager()