Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -118,13 +118,25 @@ def plot_scatter_tab5(cat, x, y, z, col):
|
|
| 118 |
grouped_cat["count"] = grouped_cat.groupby(["model"])["count"].transform(lambda x: x / x.sum())
|
| 119 |
|
| 120 |
# Pivot the data for stacking
|
| 121 |
-
pivot_df = grouped_cat.pivot(index='model', columns='tag', values='count').fillna(0)
|
| 122 |
-
#
|
| 123 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
if col == "Size":
|
| 125 |
-
pivot_df[col] = pivot_df.
|
| 126 |
else:
|
| 127 |
-
pivot_df[col] = pivot_df.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
# Create an interactive scatter plot
|
| 130 |
# fig = px.scatter(pivot_df, x=x, y=y, hover_name=pivot_df.index, title=f'{x} vs {y}', color=col, color_continuous_scale="agsunset")
|
|
|
|
| 118 |
grouped_cat["count"] = grouped_cat.groupby(["model"])["count"].transform(lambda x: x / x.sum())
|
| 119 |
|
| 120 |
# Pivot the data for stacking
|
| 121 |
+
# pivot_df = grouped_cat.pivot(index='model', columns='tag', values='count').fillna(0)
|
| 122 |
+
# if col == "Size":
|
| 123 |
+
# pivot_df[col] = pivot_df.index.map(size_map)
|
| 124 |
+
# else:
|
| 125 |
+
# pivot_df[col] = pivot_df.index.str.split("/").str[0]
|
| 126 |
+
|
| 127 |
+
pivot_df = grouped_cat.pivot(index='model', columns='tag', values='count').fillna(0).reset_index()
|
| 128 |
+
|
| 129 |
if col == "Size":
|
| 130 |
+
pivot_df[col] = pivot_df["model"].map(size_map)
|
| 131 |
else:
|
| 132 |
+
pivot_df[col] = pivot_df["model"].str.split("/").str[0]
|
| 133 |
+
|
| 134 |
+
fig = px.scatter_3d(pivot_df, x=x, y=y, z=z,
|
| 135 |
+
hover_name="model",
|
| 136 |
+
title=f'{x} vs {y} vs {z}',
|
| 137 |
+
color=col,
|
| 138 |
+
color_continuous_scale="agsunset")
|
| 139 |
+
|
| 140 |
|
| 141 |
# Create an interactive scatter plot
|
| 142 |
# fig = px.scatter(pivot_df, x=x, y=y, hover_name=pivot_df.index, title=f'{x} vs {y}', color=col, color_continuous_scale="agsunset")
|