GMARTINEZMILLA commited on
Commit
d1ec67b
·
1 Parent(s): 79c4c27

feat: Updated colours in 3D cluster

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -227,8 +227,9 @@ if page == "📃 Resumen":
227
  # Middle Column (White): 3D Cluster Model and Bar Chart
228
  with col2:
229
  st.markdown('#### Cluster de Clientes 3D')
 
230
 
231
- # Create 3D PCA plot using actual data from pca_data_5
232
  fig_cluster = px.scatter_3d(
233
  pca_data_5,
234
  x='PC1',
@@ -237,12 +238,12 @@ if page == "📃 Resumen":
237
  color='cluster_id',
238
  hover_name='CustomerID',
239
  color_discrete_map={
240
- 0: '#FFD700', # Deeper yellow for cluster 0
241
- 1: '#FFA500', # Orange for cluster 1
242
- 2: '#FF6347', # Tomato for cluster 2
243
- 3: '#FF4500', # OrangeRed for cluster 3
244
- 4: '#FF0000' # Red for cluster 4
245
- },
246
  )
247
  fig_cluster.update_layout(
248
  scene=dict(aspectratio=dict(x=1, y=1, z=0.8)), # Adjusted aspect ratio for better balance
 
227
  # Middle Column (White): 3D Cluster Model and Bar Chart
228
  with col2:
229
  st.markdown('#### Cluster de Clientes 3D')
230
+ pca_data_5['cluster_id'] = pca_data_5['cluster_id'].astype(str)
231
 
232
+ # Create 3D PCA plot using actual data from pca_data_5 with specific color map for clusters
233
  fig_cluster = px.scatter_3d(
234
  pca_data_5,
235
  x='PC1',
 
238
  color='cluster_id',
239
  hover_name='CustomerID',
240
  color_discrete_map={
241
+ '0': '#FFD700', # Deeper yellow for cluster 0
242
+ '1': '#FFA500', # Orange for cluster 1
243
+ '2': '#FF6347', # Tomato for cluster 2
244
+ '3': '#FF4500', # OrangeRed for cluster 3
245
+ '4': '#FF0000' # Red for cluster 4
246
+ },
247
  )
248
  fig_cluster.update_layout(
249
  scene=dict(aspectratio=dict(x=1, y=1, z=0.8)), # Adjusted aspect ratio for better balance