3
我有一個數據幀,部分重放這樣:seaborn熱圖的顏色方案值
import pandas as pd
import numpy as np
tab = pd.DataFrame(np.array([[ 46, 39, 25, 29, 21, 12, 33, 32, 70, 109, 144, 158, 161,
184, 163, 113, 117, 82, 76, 88, 77, 76, 64, 35],
[ 39, 33, 29, 29, 26, 14, 25, 33, 60, 83, 126, 117, 111,
148, 141, 104, 92, 75, 78, 74, 63, 67, 52, 39],
[ 30, 27, 14, 11, 20, 17, 21, 31, 48, 62, 83, 78, 88,
90, 80, 67, 53, 61, 47, 54, 50, 48, 35, 26],
[ 30, 24, 19, 15, 17, 10, 12, 18, 34, 69, 88, 79, 109,
95, 89, 82, 53, 46, 53, 57, 39, 41, 26, 29],
[ 37, 31, 18, 12, 30, 13, 15, 19, 51, 61, 74, 81, 77,
100, 96, 74, 60, 57, 42, 48, 43, 40, 29, 25],
[ 14, 8, 14, 11, 13, 7, 9, 15, 42, 49, 50, 44, 53,
42, 31, 31, 30, 27, 33, 25, 27, 17, 20, 17],
[ 10, 15, 6, 10, 15, 11, 7, 18, 28, 43, 49, 37, 41,
33, 37, 32, 26, 28, 19, 24, 19, 19, 13, 18],
[ 9, 9, 8, 12, 7, 11, 4, 8, 14, 15, 23, 30, 29,
34, 25, 39, 22, 20, 15, 23, 12, 19, 14, 13],
[ 0, 3, 4, 1, 1, 0, 3, 4, 4, 5, 3, 5, 6,
7, 3, 3, 6, 4, 2, 3, 3, 2, 2, 2],
[ 3, 0, 1, 0, 0, 0, 1, 1, 4, 8, 2, 4, 7,
2, 2, 9, 3, 5, 1, 5, 2, 0, 4, 1]]), index =
['Stadsdeel Zuid', 'Stadsdeel West', 'Stadsdeel Nieuw-West',
'Stadsdeel Centrum', 'Stadsdeel Oost', 'Stadsdeel Noord',
'Wijk 00 Amstelveen', 'Stadsdeel Zuidoost', 'Wijk 00',
'Wijk 00 Aalsmeer'])
和我創建了一個熱圖這樣
ax = sns.heatmap(tab, linewidths=.5 ,robust=True ,annot_kws = {'size':14})
ax.tick_params(labelsize=14)
ax.figure.set_size_inches((12, 10))
我想,雖然這個重視錨顏色映射基於最小值 - 最大值每行,以便具有較低值的行也很清晰可見。 (在實際情況中,表格包含更多行,值低,熱圖幾乎不顯示顏色)
如何實現此目的?
請發表您的原始數據集的一些原始數據,以便我們能夠重現你的問題。從圖像複製和粘貼數據很困難。 –
你是對的。查看更新的回答 –
聽起來就像你想規範化行? – mwaskom