aalkaswan commited on
Commit
71254b7
·
verified ·
1 Parent(s): e5185c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -5
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
- # pivot_df = pivot_df.sort_values(by="A", ascending=False)
123
- # add color vis
 
 
 
 
 
124
  if col == "Size":
125
- pivot_df[col] = pivot_df.index.map(size_map)
126
  else:
127
- pivot_df[col] = pivot_df.index.str.split("/").str[0]
 
 
 
 
 
 
 
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")