seyia92coding
commited on
Commit
•
0f824c3
1
Parent(s):
b1c40f0
Update app.py
Browse files
app.py
CHANGED
@@ -24,6 +24,7 @@ import seaborn as sns
|
|
24 |
import gradio as gr
|
25 |
#https://gradio.app/docs/#i_slider
|
26 |
import matplotlib.pyplot as plt
|
|
|
27 |
import time
|
28 |
import numpy as np
|
29 |
|
@@ -167,6 +168,13 @@ def gradio_music_graph(client_id, client_secret, artist_name): #total_albums
|
|
167 |
plt.tight_layout(rect=[1, 2.5, 1, 0.45]) #(left, bottom, right, top)
|
168 |
|
169 |
sns.boxplot(x=df["album_name"], y=df["popularity"], ax=ax)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
plt.show()
|
171 |
|
172 |
return fig
|
|
|
24 |
import gradio as gr
|
25 |
#https://gradio.app/docs/#i_slider
|
26 |
import matplotlib.pyplot as plt
|
27 |
+
import matplotlib.patches as mpatches
|
28 |
import time
|
29 |
import numpy as np
|
30 |
|
|
|
168 |
plt.tight_layout(rect=[1, 2.5, 1, 0.45]) #(left, bottom, right, top)
|
169 |
|
170 |
sns.boxplot(x=df["album_name"], y=df["popularity"], ax=ax)
|
171 |
+
|
172 |
+
leg_handles = []
|
173 |
+
for label, artist in zip(labels,ax.artists):
|
174 |
+
handle = mpatches.Patch(facecolor=artist.get_facecolor(),label=label)
|
175 |
+
leg_handles.append(handle)
|
176 |
+
ax.legend(handles=leg_handles,bbox_to_anchor=(0., 1.02, 1., .102), loc=3, ncol=1, mode="expand", borderaxespad=0.)
|
177 |
+
|
178 |
plt.show()
|
179 |
|
180 |
return fig
|