title: How do I get my data in my heatmap?
body: <p>I've programmed Conways Game of Life in Python and now I'm trying to display the simple data that it gives me as an output in a heat map.<br>
  This is my current code:  </p>
  
  <pre><code>from Tkinter import *
  
  import matplotlib.pyplot as plt
  import time
  import numpy as np
  import random
  
  size_x = 100
  size_y = 10
  
  # create the matrices
  cell = [[0 for row in range(0, size_y)] for col in range(0, size_x)]
  live = [[0 for row in range(0, size_y)] for col in range(0, size_x)]
  temp = [[0 for row in range(0, size_y)] for col in range(0, size_x)]
  
  # process and draw the next frame
  def frame():
      process()
      draw()
      root.after(100, frame)
  
  # load the initial data
  def load(initial=0.5):
      for y in range(0, size_y):
          for x in range(0, size_x):
              if random.random()&lt;initial: live[x][y] = 1
              temp[x][y] = 0
  
  
  # Applying rules
  def process():
      for y in range(0, size_y):
          for x in range(0, size_x):
              lives = live_neighbors(x,y)
              if live[x][y] == 1:
                  if lives &lt; 2 or lives &gt; 3:
                      temp[x][y] = 0
                  else:
                      temp[x][y] = 1
              if live[x][y] == 0:
                  if lives == 3:
                      temp[x][y] = 1
                  else:
                      temp[x][y] = 0
  
      for y in range(0, size_y):
          for x in range(0, size_x):
              live[x][y] = temp[x][y]
  #   live = temp
  
  # Count live neighbors
  def live_neighbors(a,b):
      lives = 0 
      if live[a][(b+1)%size_y] == 1: lives += 1
      if live[a][(b-1)%size_y] == 1: lives += 1   
      if live[(a+1)%size_x][b] == 1: lives += 1
      if live[(a+1)%size_x][(b+1)%size_y] == 1: lives += 1
      if live[(a+1)%size_x][(b-1)%size_y] == 1: lives += 1
      if live[(a-1)%size_x][b] == 1: lives += 1
      if live[(a-1)%size_x][(b+1)%size_y] == 1: lives += 1
      if live[(a-1)%size_x][(b-1)%size_y] == 1: lives += 1
      return lives
  
  # Draw all cells
  def draw():
      nLiving = 0
      nDead = 0
      for y in range(size_y):
          for x in range(size_x):
              if live[x][y]==0:
                  canvas.itemconfig(cell[x][y], fill="black")
                  nDead+=1
              if live[x][y]==1:
                  canvas.itemconfig(cell[x][y], fill="white")
                  nLiving+=1
      print nLiving,nDead
  
  
  # count cells
  def count():
      nLiving = 0
      nDead = 0
      for y in range(size_y):
          for x in range(size_x):
              if live[x][y]==0:
                  nDead+=1
              if live[x][y]==1:
                  nLiving+=1
      z = nLiving / 10.0
      print z,
      print "%"
  
  
  def one_game(initial):
      load(initial)
      for gen in range(1, 101):
          print str(gen) + ":",
          count()
          process()
  
  def many_games():
      numbers = range(1,51)
      for initial in numbers:
          print initial/100.0
          one_game(initial/100.0)
  
  
  many_games()
  #one_game(0.5)
  </code></pre>
  
  <p>The code for making a normal heat map with given input would be:</p>
  
  <pre><code>fig, ax = plt.subplots(1)
  
  x = np.array( [[11,12,13], [21,22,23], [31,32,33]] )
  
  p = ax.pcolormesh(x)
  fig.colorbar(p)
  plt.show()
  </code></pre>
  
  <p>How do I get my data (which in this case would be, the generations, the value which <em>initializes</em> the one_game() function, and <em>nLiving</em>) into an array?</p>