Skip to content

Commit

Permalink
Update plot_FigS2B.py
Browse files Browse the repository at this point in the history
revised FigS2B
  • Loading branch information
DevlinaC authored Jul 12, 2024
1 parent ecabc08 commit 36c8425
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions scripts/plot_FigS2B.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
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 / "FigS2B.png"
output_file = plot_dir / "FigS2B_revised.png"

plt.figure(figsize=(10,14))
plt.rcParams.update({'font.size': 20})
plt.figure(figsize=(12, 16))
plt.rcParams.update({'font.size': 16})
plt.rcParams["font.weight"] = "bold"
plt.rcParams["font.family"] = "Helvetica"
plt.tight_layout()

# the values are taken from data/success_with_RMSD_metric.xlsx
values = [8, 10, 7, 6, 14, 25, 56]
val1 = [1, 9, 2, 2, 1, 6, 11, 39]
val2 = [7, 1, 5, 3, 5, 7, 17, 17]

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

ax = sns.barplot(x=names, y=values,color='black')
totals = [x + y for x, y in zip(val1, val2)]

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')
ax.set_xticklabels(ax.get_xticklabels(), rotation=45,
fontweight='bold', horizontalalignment='right')
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("#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)

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)
# for RMSD metric
plt.savefig(output_file, bbox_inches='tight',
edgecolor='black', dpi=600, transparent=True

0 comments on commit 36c8425

Please sign in to comment.