import matplotlib.pyplot as plt import numpy as np import pandas as pd a = np.random.random((5, 4)) df = pd.DataFrame({'a': a[0], 'b': a[1], 'c': a[2], 'd': a[3], 'e': a[4]}) rows = list('abcd') columns = list(df.columns) fig = plt.figure(figsize=(10,10), dpi=72) ax = fig.add_subplot(111) plt.pcolor(df, cmap = plt.cm.Reds) # cmap='hot' ax.set_xticks(np.arange(0,5)+0.5) ax.set_yticks(np.arange(0,4)+0.5) ax.set_yticklabels(rows) ax.set_xticklabels(columns) plt.show()
No comments:
Post a Comment