Spaces:
Sleeping
Sleeping
vickeee465
commited on
Commit
·
8deb410
1
Parent(s):
acd22e7
fixing y-axis
Browse files
app.py
CHANGED
@@ -99,22 +99,16 @@ def plot_emotion_heatmap(heatmap_data):
|
|
99 |
|
100 |
|
101 |
def plot_emotion_barplot(heatmap_data):
|
102 |
-
most_probable_emotions = heatmap_data.idxmax(axis=
|
103 |
emotion_counts = most_probable_emotions.value_counts()
|
104 |
-
|
105 |
-
# Normalize to get relative frequencies
|
106 |
emotion_frequencies = (emotion_counts / emotion_counts.sum()).sort_values(ascending=False)
|
107 |
-
|
108 |
fig, ax = plt.subplots(figsize=(8, 6))
|
109 |
sns.barplot(x=emotion_frequencies.values, y=emotion_frequencies.index, palette="coolwarm", ax=ax)
|
110 |
-
|
111 |
ax.set_title("Relative Frequencies of Most Probable Emotions")
|
112 |
ax.set_xlabel("Relative Frequency")
|
113 |
ax.set_ylabel("Emotions")
|
114 |
-
|
115 |
for i, value in enumerate(emotion_frequencies.values):
|
116 |
ax.text(value + 0.01, i, f"{value:.2f}", va='center')
|
117 |
-
|
118 |
plt.tight_layout()
|
119 |
return fig
|
120 |
|
|
|
99 |
|
100 |
|
101 |
def plot_emotion_barplot(heatmap_data):
|
102 |
+
most_probable_emotions = heatmap_data.idxmax(axis=0)
|
103 |
emotion_counts = most_probable_emotions.value_counts()
|
|
|
|
|
104 |
emotion_frequencies = (emotion_counts / emotion_counts.sum()).sort_values(ascending=False)
|
|
|
105 |
fig, ax = plt.subplots(figsize=(8, 6))
|
106 |
sns.barplot(x=emotion_frequencies.values, y=emotion_frequencies.index, palette="coolwarm", ax=ax)
|
|
|
107 |
ax.set_title("Relative Frequencies of Most Probable Emotions")
|
108 |
ax.set_xlabel("Relative Frequency")
|
109 |
ax.set_ylabel("Emotions")
|
|
|
110 |
for i, value in enumerate(emotion_frequencies.values):
|
111 |
ax.text(value + 0.01, i, f"{value:.2f}", va='center')
|
|
|
112 |
plt.tight_layout()
|
113 |
return fig
|
114 |
|