Created
May 19, 2019 17:24
-
-
Save subeshb1/83fd2675beea158a3a08e351a48494bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np; np.random.seed(0) | |
import seaborn as sns; sns.set() | |
import pandas as pd | |
df = pd.read_csv("data.csv") | |
# print(df) | |
df = df.pivot_table(values='data', index=['name'],columns=['frame']) | |
# print(df) | |
df.columns.str.strip() | |
cmap = sns.color_palette("Reds") | |
uniform_data = np.random.rand(10, 12) | |
ax = sns.heatmap(df, cmap='Reds', annot=True) | |
for i in range(1,97): | |
if ('frame_' + str(i)) not in df.columns: | |
df['frame_' + str(i)] = 0 | |
df= df.reindex(sorted(df.columns,key=lambda x: int(x.split('_')[-1])), axis=1) | |
import matplotlib.pyplot as plt | |
fig, ax = plt.subplots(figsize=(96,5)) | |
df = df.sort_values(by='name', ascending=False) | |
ax = sns.heatmap(df, cmap='Reds', annot=True, linewidths=1, ax=ax) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment