Python Forum
Seaborn heatmap intervals - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Seaborn heatmap intervals (/thread-34562.html)



Seaborn heatmap intervals - ranbarr - Aug-09-2021

Hi all,
Im creating a heatmap using seaborn in python, and I want to set the intervals between the minimum value and maximum value to be 0.05.
right now, my problem is that there are some lines that showing all blue and not showing differences because their values are to low.
but the comparision should be between the same row and not to the other rows that Im checking.
this is my code:
with open('heat1.csv', 'r', encoding='mac_roman', newline='') as csvfile:
    df = pd.read_csv(csvfile, sep=',')
    df['id'] = df['id'].apply(lambda x: x[:-2])
    df = df.fillna(0)   
    grpby = df.groupby('id', as_index=True).mean()
    normalized = preprocessing.normalize(grpby)
    vmin1 = normalized.min(axis=0)
    vmax1 = normalized.max(axis=0)
    # print(vmax1)
    plt.subplots(figsize = (250,100))
    sns.set(font_scale=7.5)
    sns.heatmap(normalized, cmap='coolwarm', vmin = 0 , vmax=0.6, linewidths=0.2, robust=True)  
    plt.ylabel('')
    plt.show()
and right now this is an examle of the heatmap Im getting:
https://ibb.co/nPh2Ygf

I tried to use the vmin1 and vmax1 variables to define the vmax and vmin of the map to be the values of each row, but I got a value error.
Any help is appreciated, thanks!