Skip to content

Commit

Permalink
Update plot_Fig1A.py
Browse files Browse the repository at this point in the history
revised figure1
  • Loading branch information
DevlinaC authored Jul 12, 2024
1 parent 70760ad commit ecabc08
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions scripts/plot_Fig1A.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from pathlib import Path

# setting path and directories
main_dir = Path("/Users/chakravartyd2/fold_switching/mchaourab_project/for_github_repo")
plot_dir = main_dir / "plots"
output_file = plot_dir / "Fig1A.png"
output_file = plot_dir / "Fig1A_revised.png"

# setting figure parameters
plt.figure(figsize=(10, 14))
Expand All @@ -14,21 +14,27 @@
plt.rcParams["font.family"] = "Helvetica"

# values are taken from success_with_TMscore_metric.xlsx
values = [8, 11, 12, 7, 18, 23, 56]
val1 = [2, 9, 5, 2, 1, 7, 12, 36] # unique
val2 = [6, 2, 7, 5, 6, 11, 20, 20] # common

names = ["AF2.2.0", "AF2.3.1","AF2_multimer","AF3","SPEACH_AF","AF-cluster","All_AF","ACE"]

names = ["AF2.2.0", "AF2.3.1", "AF2_multimer",
"SPEACH_AF", "AF-cluster", "All_AF2", "ACE"]
threshold = 93
totals = [x + y for x, y in zip(val1, val2)]

ax = sns.barplot(x=names, y=values, color='black')
df = pd.DataFrame({'unique':val1,'common':val2},index=names)
threshold = 92
ax = df.plot(kind='bar', stacked=True, color=['grey', 'black'])
ax.set_ylim(1, 100)
ax.set_xticklabels(ax.get_xticklabels(), rotation=45,
fontweight='bold', horizontalalignment='right')
for i, v in enumerate(values):
ax.text(i, v + 0.2, str(v), fontsize=21, weight='bold', ha='center')

for i, v in enumerate(totals):
ax.text(i, v + 0.2, str(v), fontsize=16, weight='bold', ha='center')
plt.axhline(threshold, color='red', ls='dashed', linewidth=2.0)

plt.ylabel("#SUCCESS", fontsize=20, fontweight="bold")

plt.savefig(str(output_file), edgecolor='black', dpi=1200, transparent=True)
plt.ylabel("#Successes", fontsize=16, fontweight="bold")
legend = plt.legend(loc="best", edgecolor=(
0, 0, 0, 1.), facecolor=(1, 1, 1, 0.0))
legend.get_frame().set_alpha(None)

# for TM-score metric
plt.savefig(output_file, bbox_inches='tight',
edgecolor='black', dpi=1200, transparent=True)

0 comments on commit ecabc08

Please sign in to comment.