Increasing Number Of Rows In Python 2d Heatmap
I am plotting python heatmap. Following is the code I am using. df = pd.read_csv('Book1.csv', index_col=0) print (df) # plotting fig,ax = plt.subplots() ax.matshow(df.mask(df.isi
Solution 1:
You can use aspect
option, but for the y-ticks, I'm not sure it's useful to have them all since it will be unreadable, but you can set some :
fig, ax = plt.subplots(figsize=(6, 10))
ax.matshow(df.mask(df.isin(df.att1)!=True), cmap=cm.Reds, aspect='auto')
ax.matshow(df.mask(df.isin(df.att2)!=True), cmap=cm.Greens, aspect='auto')
ax.matshow(df.mask(df.isin(df.att3)!=True), cmap=cm.Blues, aspect='auto')
plt.xticks(range(3), df.columns)
plt.yticks(range(0, 800, 100), df.index[::100])
Hope this helps
Post a Comment for "Increasing Number Of Rows In Python 2d Heatmap"