Python Forum
How to plot seaborn heatmap on top of a background circle
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to plot seaborn heatmap on top of a background circle
#1
Hi,
I have below code to visualize data, and I want to ensemble a circle (heatmap inside big circle).

data is below:
helix1 phase	helix 2 phase	Energy
-0.1	-0.1	1
-0.2	-0.2	0
-0.3	-0.3	0
-0.4	-0.4	2
-0.5	-0.5	8
-0.6	-0.6	7
0.8	0.8	9
0.9	0.9	1
0	0	0
0.1	0.1	0
0.2	0.2	0
0.3	0.3	0
0.4	0.4	0
0.5	0.5	1
0.6	0.6	2
-0.8	-0.8	7
-0.9	-0.9	15
%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np

helix = pd.read_csv('E:\python\heatmaptest.csv')
couple_columns = helix[['Energy','helix 2 phase', 'helix1 phase']]
phase_1_2 = couple_columns.groupby(['helix1 phase', 'helix 2 phase']).mean()
phase_1_2 = couple_columns.groupby(['helix1 phase', 'helix 2 phase']).mean()

import numpy as np;
import seaborn as sns; 

phase_1_2.pivot('helix1 phase', 'helix 2 phase','Energy').head()
phase_1_2.pivot('helix1 phase', 'helix 2 phase')['Energy'].head()



plt.figure(figsize=(9,9))
pivot_table = phase_1_2.pivot('helix1 phase', 'helix 2 phase','Energy')
plt.xlabel('helix 2 phase', size = 15)
plt.ylabel('helix1 phase', size = 15)
plt.title('Energy from Helix Phase Angles', size = 15)
sns.heatmap(pivot_table, annot=True, fmt=".1f", linewidths=.5, square = True, cmap = 'coolwarm')
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to loop through code to plot seaborn line plots across multiple subplots eyavuz21 0 1,693 Dec-05-2022, 10:46 AM
Last Post: eyavuz21
  Installing and Using Seaborn Led_Zeppelin 4 2,588 Jun-07-2022, 09:44 PM
Last Post: snippsat
  drawing moving circle on line with python barrai 1 3,140 Feb-25-2022, 03:33 PM
Last Post: BashBedlam
  Program to move a dot towards a circle center plumberpy 10 4,223 Dec-03-2021, 12:20 PM
Last Post: BashBedlam
  How to increase the size of a png picture for the heatmap of the correlation? lulu43366 9 3,538 Oct-06-2021, 04:15 PM
Last Post: deanhystad
  How to remove a column or two columns in a correlation heatmap? lulu43366 3 5,243 Sep-30-2021, 03:47 PM
Last Post: lulu43366
  Draw circle from GPS coords, and get GPX file? Winfried 0 2,186 Mar-29-2021, 07:19 PM
Last Post: Winfried
  How to plot intraday data of several days in one plot mistermister 3 2,929 Dec-15-2020, 07:43 PM
Last Post: deanhystad
  titanic from Seaborn matador 3 4,674 Aug-20-2020, 12:13 PM
Last Post: buran
  Pyplot and circle Reldaing 0 1,489 Apr-01-2020, 10:44 AM
Last Post: Reldaing

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020