Skip to content

Commit ad735ac

Browse files
committed
updated figure
1 parent 448bb45 commit ad735ac

13 files changed

+29
-19
lines changed

generate_figures.py

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ def create_plot(ax, x_data: list, y_data: list, auc: float, type: str, color) ->
5555
def main():
5656
print("Generating figures")
5757
species_list = ["elegans", "fly", "bsub", "yeast", "zfish"]
58-
species_title = ["C. elegans", "D. melanogaster", "B. subtilis", "S. cerevisiae", "D. rerio"]
58+
species_title = [
59+
"C. elegans",
60+
"D. melanogaster",
61+
"B. subtilis",
62+
"S. cerevisiae",
63+
"D. rerio",
64+
]
5965

6066
file_directories = [
6167
"./results/final-non-inferred-complete/",
@@ -148,7 +154,7 @@ def main():
148154
plt.tight_layout() # Adjust rect to accommodate legends
149155
# Adjust the space between subplots
150156
plt.subplots_adjust(wspace=0.2)
151-
plt.savefig(Path("./results/images/", f"roc_{subplot_titles[k].lower().replace(" ", "_")}"))
157+
plt.savefig(Path("./results/images/", f"roc_{subplot_titles[k].lower().replace(" ", "_")}.pdf"), format="pdf")
152158
plt.show()
153159

154160
fig, axes = plt.subplots(
@@ -186,7 +192,7 @@ def main():
186192
plt.tight_layout() # Adjust rect to accommodate legends
187193
# Adjust the space between subplots
188194
plt.subplots_adjust(wspace=0.2)
189-
plt.savefig(Path("./results/images/", f"pr_{subplot_titles[k].lower().replace(" ", "_")}"))
195+
plt.savefig(Path("./results/images/", f"pr_{subplot_titles[k].lower().replace(" ", "_")}.pdf"), format="pdf")
190196
plt.show()
191197
k += 1
192198

@@ -228,7 +234,7 @@ def main():
228234
final_rw_data[species].append(species_data)
229235

230236
# Create a 2x2 subplot layout
231-
fig, axs = plt.subplots(2, 2, figsize=(10, 10)) # 2 rows, 2 columns
237+
fig, axs = plt.subplots(1, 4, figsize=(40, 12)) # 2 rows, 2 columns
232238
axs = axs.flatten() # Flatten to easily index the subplots
233239

234240
colors = ["red", "green", "blue", "orange", "purple"]
@@ -242,26 +248,28 @@ def main():
242248
final_rw_data[species][idx]["tpr"],
243249
color=colors[i],
244250
lw=2,
245-
label=f"${species_title[i]}$ (area = %0.2f)" % final_rw_data[species][idx]["roc"],
251+
label=f"${species_title[i]}$ (area = %0.2f)"
252+
% final_rw_data[species][idx]["roc"],
246253
)
247254

248255
ax.set_xlim([0.0, 1.0])
249256
ax.set_ylim([0.0, 1.05])
250-
ax.set_xlabel("False Positive Rate")
251-
ax.set_ylabel("True Positive Rate")
252-
ax.set_title(f"{subplot_titles[idx]}")
253-
ax.legend(loc="lower right")
257+
ax.set_xlabel("False Positive Rate", fontsize=30)
258+
ax.set_ylabel("True Positive Rate", fontsize=30)
259+
ax.set_title(f"{subplot_titles[idx]}", fontsize=30)
260+
ax.legend(loc="lower right", fontsize=30)
261+
ax.tick_params(axis="both", which="major", labelsize=20)
254262

255263
# Adjust layout and show the plot
256264
fig.suptitle(
257265
"ROC Curve for RandomWalk Configuration",
258-
fontsize=20,
266+
fontsize=45,
259267
)
260-
plt.savefig(Path("./results/images/rw_roc.png"))
261268
plt.tight_layout()
269+
plt.savefig(Path("./results/images/rw_roc.pdf"), format="pdf")
262270
plt.show()
263271

264-
fig, axs = plt.subplots(2, 2, figsize=(10, 10)) # 2 rows, 2 columns
272+
fig, axs = plt.subplots(1, 4, figsize=(40, 12)) # 2 rows, 2 columns
265273
axs = axs.flatten() # Flatten to easily index the subplots
266274

267275
colors = ["red", "green", "blue", "orange", "purple"]
@@ -275,23 +283,25 @@ def main():
275283
final_rw_data[species][idx]["precision"],
276284
color=colors[i],
277285
lw=2,
278-
label=f"${species_title[i]}$ (area = %0.2f)" % final_rw_data[species][idx]["pr"],
286+
label=f"${species_title[i]}$ (area = %0.2f)"
287+
% final_rw_data[species][idx]["pr"],
279288
)
280289

281290
ax.set_xlim([0.0, 1.0])
282291
ax.set_ylim([0.0, 1.05])
283-
ax.set_xlabel("Recall")
284-
ax.set_ylabel("Precision")
285-
ax.set_title(f"{subplot_titles[idx]}")
286-
ax.legend(loc="lower left")
292+
ax.set_xlabel("Recall", fontsize=30)
293+
ax.set_ylabel("Precision", fontsize=30)
294+
ax.set_title(f"{subplot_titles[idx]}", fontsize=30)
295+
ax.legend(loc="lower right", fontsize=30)
296+
ax.tick_params(axis="both", which="major", labelsize=20)
287297

288298
# Adjust layout and show the plot
289299
fig.suptitle(
290300
"Precision/Recall Curve for RandomWalk Configuration",
291-
fontsize=20,
301+
fontsize=45,
292302
)
293-
plt.savefig(Path("./results/images/rw_pr.png"))
294303
plt.tight_layout()
304+
plt.savefig(Path("./results/images/rw_pr.pdf"), format="pdf")
295305
plt.show()
296306

297307

101 KB
Binary file not shown.
-201 KB
Binary file not shown.
93.1 KB
Binary file not shown.
-186 KB
Binary file not shown.
83.7 KB
Binary file not shown.
-214 KB
Binary file not shown.
71.2 KB
Binary file not shown.
-220 KB
Binary file not shown.

results/images/rw_pr.pdf

132 KB
Binary file not shown.

0 commit comments

Comments
 (0)