Visualising results

This tutorial will show you briefly how to visualise some basic results

Visualising the results of the tournament

As shown in Creating and running a simple tournament, let us create a tournament, but this time we will include a player that acts randomly:

>>> import axelrod as axl
>>> players = [axl.Cooperator(), axl.Defector(),
...            axl.TitForTat(), axl.Grudger()]
>>> players.append(axl.Random())
>>> tournament = axl.Tournament(players)
>>> results =

We can view these results (which helps visualise the stochastic effects):

>>> plot = axl.Plot(results)
>>> p = plot.boxplot()

Visualising the distributions of wins

We can view the distributions of wins for each strategy:

>>> p = plot.winplot()

Visualising the payoff matrix

We can also easily view the payoff matrix described in Accessing tournament results, this becomes particularly useful when viewing the outputs of tournaments with a large number of strategies:

>>> p = plot.payoff()

Saving all plots

The axelrod.Plot class has a method: save_all_plots that will save all the above plots to file.

Passing various objects to plot

The library give access to underlying matplotlib axes objects of each plot, thus the user can easily modify various aspects of a plot:

>>> import matplotlib.pyplot as plt
>>> _, ax = plt.subplots()
>>> title = ax.set_title('Payoff')
>>> xlabel = ax.set_xlabel('Strategies')
>>> p = plot.boxplot(ax=ax)