Update demo/modules/search.py
Browse files- demo/modules/search.py +11 -3
demo/modules/search.py
CHANGED
@@ -45,10 +45,18 @@ def plot(scores) -> None:
|
|
45 |
scores: List of scores
|
46 |
"""
|
47 |
plt.hist(scores, bins=100, density=True, alpha=0.6)
|
48 |
-
plt.title('Distribution of similarity scores', fontsize=15)
|
49 |
plt.xlabel('Similarity score', fontsize=15)
|
50 |
plt.ylabel('Density', fontsize=15)
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
mu, std = norm.fit(scores)
|
53 |
|
54 |
# Plot the Gaussian
|
@@ -59,7 +67,7 @@ def plot(scores) -> None:
|
|
59 |
plt.plot(x, p)
|
60 |
|
61 |
# Plot total number of scores
|
62 |
-
|
63 |
|
64 |
# Convert the plot to svg format
|
65 |
plt.savefig(tmp_plot_path)
|
|
|
45 |
scores: List of scores
|
46 |
"""
|
47 |
plt.hist(scores, bins=100, density=True, alpha=0.6)
|
48 |
+
plt.title('Distribution of similarity scores in the database', fontsize=15)
|
49 |
plt.xlabel('Similarity score', fontsize=15)
|
50 |
plt.ylabel('Density', fontsize=15)
|
51 |
+
y_ed = plt.gca().get_ylim()[-1]
|
52 |
+
plt.ylim(-0.05, y_ed)
|
53 |
+
|
54 |
+
# Add note
|
55 |
+
x_st = plt.gca().get_xlim()[0]
|
56 |
+
text = ("Note: For the \"UniRef50\" and \"Uncharacterized\" databases, the figure illustrates\n "
|
57 |
+
"only top-ranked clusters (identified using Faiss), whereas for other databases, it\n "
|
58 |
+
"displays the distribution across all samples.")
|
59 |
+
plt.text(x_st, -0.04, text, fontsize=8)
|
60 |
mu, std = norm.fit(scores)
|
61 |
|
62 |
# Plot the Gaussian
|
|
|
67 |
plt.plot(x, p)
|
68 |
|
69 |
# Plot total number of scores
|
70 |
+
plt.text(xmax, 0.9*ymax, f"Total number: {len(scores)}", ha='right', fontsize=12)
|
71 |
|
72 |
# Convert the plot to svg format
|
73 |
plt.savefig(tmp_plot_path)
|