Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -173,15 +173,26 @@ with ui.navset_card_tab(id="tab"):
|
|
173 |
import seaborn as sns
|
174 |
plot_type = input.plot_type_distro_sub()
|
175 |
if plot_type == "2D sub-specie - nominal":
|
176 |
-
df = pd.read_parquet('
|
177 |
df = process_data_sub_specie(df, input.virus_selector_2(), input.variance())
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
return ax
|
186 |
|
187 |
|
|
|
173 |
import seaborn as sns
|
174 |
plot_type = input.plot_type_distro_sub()
|
175 |
if plot_type == "2D sub-specie - nominal":
|
176 |
+
df = pd.read_parquet('new_viral_dataset.parquet')
|
177 |
df = process_data_sub_specie(df, input.virus_selector_2(), input.variance())
|
178 |
+
fig, ax = plt.subplots()
|
179 |
+
# Get unique groups and assign colors
|
180 |
+
groups = df['group'].unique()
|
181 |
+
colors = plt.cm.rainbow(np.linspace(0, 1, len(groups)))
|
182 |
+
color_dict = dict(zip(groups, colors))
|
183 |
+
|
184 |
+
# Iterate through rows and plot
|
185 |
+
for _, row in df.iterrows():
|
186 |
+
x, y = zip(*row['two_d'])
|
187 |
+
ax.plot(x, y, c=color_dict[row['group']])
|
188 |
+
|
189 |
+
# Remove duplicate labels
|
190 |
+
handles, labels = ax.get_legend_handles_labels()
|
191 |
+
by_label = dict(zip(labels, handles))
|
192 |
+
#ax.legend(by_label.values(), by_label.keys())
|
193 |
+
|
194 |
+
ax.set_title("Sub-specie"))
|
195 |
+
|
196 |
return ax
|
197 |
|
198 |
|