<jupyter_start><jupyter_text>Bar-Plots<jupyter_code>import pandas as pd
import numpy as np
import json as json
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
sns.set(font_scale=3.5)
with open("data/id2name.json","r")as f:
    id2name = json.load(f)<jupyter_output><empty_output><jupyter_text>Data<jupyter_code>data = pd.read_csv('../result/caseolap.csv')
data = data.set_index('protein')
#def rearrang(olddf):
#    col = ['Aged','Diabetes','Hyperlipidemias','Hypertension']
#    newdf = pd.DataFrame()
#    for t in col:
#        newdf[t]= olddf[t]
#    return newdf
#ndf = rearrang(data)
ndf = data
ndf.head()
ndf.shape
allp = list(ndf.index)<jupyter_output><empty_output><jupyter_text>------------------  Bar Plot<jupyter_code>sdf = ndf.copy(deep = True)
sdf['sum'] = sum([sdf[x] for x in sdf.columns])
sdf  = sdf.sort_values( ["sum"],axis =0,ascending =False)
sdf = sdf.drop(["sum"], axis = 1)
sdf.head()
sdf[0:20].plot.barh(stacked=True,figsize=(14, 10),fontsize =15)
plt.legend(fontsize=15)
plt.gca().invert_yaxis()
plt.xlabel('Scores',fontsize =15)
plt.ylabel('Proteins',fontsize =15)
plt.savefig('plots/barplot.pdf')
plt.savefig('plots/barplot.png')
names = []
for item in sdf.index:
    names.append(id2name[item])

sdf['names'] =names
sdf.to_csv("data/barplot-data.csv")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1850187265917603, 'fraction_numerical': 0.01647940074906367, 'mean_word_length': 5.549019607843137, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '337275', 'license': 'MIT', 'n_tokens_mistral': 577, 'n_tokens_neox': 545, 'n_words': 93, 'path': 'Jupyter-Notebooks/Barplot.ipynb', 'repo_name': 'CaseOLAP/covid-cvd', 'size': '1335'}