Skip to content

Instantly share code, notes, and snippets.

@Quebecisnice
Created August 27, 2013 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Quebecisnice/6359074 to your computer and use it in GitHub Desktop.
Save Quebecisnice/6359074 to your computer and use it in GitHub Desktop.
Generating a simple heatmap w/ python
import numpy as np
from pandas import *
import matplotlib.pyplot as plt
Index = ['aaa', 'bbb', 'ccc', 'ddd', 'eee']
Cols = ['A', 'B', 'C', 'D']
df = DataFrame(abs(np.random.randn(5,4)), index=Index, columns = Cols)
plt.pcolor(df)
plt.yticks(np.arange(0.5, len(df.index), 1), df.index)
plt.xticks(np.arange(0.5, len(df.columns), 1), df.columns)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment