title: Create a carpetplot with discrete values
body: <p>I'd like to create a carpetplot with discrete values. For example I have these values:</p>
  
  <pre><code>import pandas as pd
  import pylab as plt
  df_data = pd.DataFrame(
      [[1, 2, 1], [1, 1, 3], [2, 2, 5], [3, 2, 1]], index=['n1', 'n2', 'n3', 'n4'], columns=['var1', 'var2', 'var3'])
  </code></pre>
  
  <p>I have also a dictionary to match these discrete values to a color:</p>
  
  <pre><code>    matcher_dict = {
      1: (236, 99, 92), 2: (75, 129, 196), 3: (244, 153, 97), 5: (135, 104, 180)}
  </code></pre>
  
  <p>I'd now like to create a carpet plot, and I thought imshow could be a way to work this out, as the documentation for imshow says</p>
  
  <blockquote>
    <p>cmap : Colormap, optional, default: None</p>
    
    <p>If None, default to rc image.cmap value. <strong>cmap is ignored when X has RGB(A) information</strong></p>
  </blockquote>
  
  <p>So I create a new Dataframe with the colors as entries:</p>
  
  <pre><code>df_color = pd.DataFrame(index=df_data.index, columns=df_data.columns)
  for col_index, col in enumerate(df_data.iteritems()):
      for row_index, value in enumerate(col[1]):
          df_color.ix[row_index].ix[col_index] = matcher_dict[
              df_data.ix[row_index].ix[col_index]]
  </code></pre>
  
  <p>Now I expect this to work:</p>
  
  <pre><code>fig,ax = plt.subplots()
  im = ax.imshow(
      df_color.values, interpolation='nearest', aspect='auto')
  </code></pre>
  
  <p>But all I get is a TypeError: Image data can not convert to float</p>
  
  <p>The result I expected (and was able to create with an terrible inefficient code should look like this <a href="http://i.stack.imgur.com/6VcPZ.png" rel="nofollow">Expected Result of the carpetplot</a></p>
  
  <p>But this just raises an TypeError, Image data can not convert to float.</p>
  
  <p>EDIT: If I use df_data.values directly (instead of df_color.values, it creates a plot, by using the default colormap. Is it possible to create a discrete colormap? (I didn't completly  understand the colormap concepts from reading matplotlibs documentation)</p>