Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,6 +24,13 @@ def plot_reduced_data(reduced_data, labels, title):
|
|
| 24 |
for i, label in enumerate(labels):
|
| 25 |
plt.annotate(label, (reduced_data[i, 0], reduced_data[i, 1]))
|
| 26 |
plt.title(title)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
plt.xlabel('Component 1')
|
| 28 |
plt.ylabel('Component 2')
|
| 29 |
plt.grid(True)
|
|
|
|
| 24 |
for i, label in enumerate(labels):
|
| 25 |
plt.annotate(label, (reduced_data[i, 0], reduced_data[i, 1]))
|
| 26 |
plt.title(title)
|
| 27 |
+
# Data for the arrow
|
| 28 |
+
start_point = (reduced_data[0, 0], reduced_data[0, 1]) # Starting point of the arrow
|
| 29 |
+
end_point = (reduced_data[1, 0], reduced_data[1, 1]) # Ending point of the arrow
|
| 30 |
+
|
| 31 |
+
# Adding an arrow
|
| 32 |
+
plt.annotate('', xy=end_point, xytext=start_point,
|
| 33 |
+
arrowprops=dict(arrowstyle="->", color='red', lw=2))
|
| 34 |
plt.xlabel('Component 1')
|
| 35 |
plt.ylabel('Component 2')
|
| 36 |
plt.grid(True)
|