Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -29,17 +29,16 @@ elif len(labels) == mesh.n_cells:
|
|
29 |
|
30 |
# Create a pyvista plotter
|
31 |
plotter = pv.Plotter()
|
32 |
-
|
33 |
-
cmap = plt.cm.get_cmap('tab20', n_clusters) # Using a colormap with sufficient distinct colors
|
34 |
|
35 |
-
colors = cmap(np.linspace(0, 1,
|
36 |
|
37 |
# Convert colors to a format acceptable by PyVista
|
38 |
colormap = mcolors.ListedColormap(colors)
|
39 |
|
40 |
# Add the mesh to the plotter with labels as a scalar field
|
41 |
#plotter.add_mesh(mesh, scalars='Labels', show_scalar_bar=True, cmap='jet')
|
42 |
-
plotter.add_mesh(mesh, scalars='Labels', show_scalar_bar=True, cmap=colormap, clim=[0,
|
43 |
|
44 |
# Show the plot
|
45 |
#plotter.show()
|
|
|
29 |
|
30 |
# Create a pyvista plotter
|
31 |
plotter = pv.Plotter()
|
32 |
+
cmap = plt.cm.get_cmap('jet', 27) # Using a colormap with sufficient distinct colors
|
|
|
33 |
|
34 |
+
colors = cmap(np.linspace(0, 1, 27)) # Generate colors
|
35 |
|
36 |
# Convert colors to a format acceptable by PyVista
|
37 |
colormap = mcolors.ListedColormap(colors)
|
38 |
|
39 |
# Add the mesh to the plotter with labels as a scalar field
|
40 |
#plotter.add_mesh(mesh, scalars='Labels', show_scalar_bar=True, cmap='jet')
|
41 |
+
plotter.add_mesh(mesh, scalars='Labels', show_scalar_bar=True, cmap=colormap, clim=[0, 27])
|
42 |
|
43 |
# Show the plot
|
44 |
#plotter.show()
|