@@ -383,36 +383,36 @@ def id_map_to_rgb(
383383 """
384384 # Initialize RGB array with white background (values between 0 and 1 for matplotlib)
385385 img = np .ones (id_map .shape , dtype = float )
386-
386+
387387 # Get the appropriate index based on color_by
388388 if color_by == 'cell' :
389389 id_index = 0 # Cell IDs are in the first channel
390390 elif color_by == 'material' :
391391 id_index = 2 # Material IDs are in the third channel
392392 else :
393393 raise ValueError ("color_by must be either 'cell' or 'material'" )
394-
394+
395395 # Get all unique IDs in the plot
396396 unique_ids = np .unique (id_map [:, :, id_index ])
397-
397+
398398 # Generate default colors if not provided
399399 if colors is None :
400400 colors = {}
401-
401+
402402 # Convert colors dict to use IDs as keys
403403 color_map = {}
404404 for key , color in colors .items ():
405405 if isinstance (key , (openmc .Cell , openmc .Material )):
406406 color_map [key .id ] = color
407407 else :
408408 color_map [key ] = color
409-
409+
410410 # Generate random colors for IDs not in color_map
411411 rng = np .random .RandomState (1 )
412412 for uid in unique_ids :
413413 if uid > 0 and uid not in color_map :
414414 color_map [uid ] = rng .randint (0 , 256 , (3 ,))
415-
415+
416416 # Apply colors to each pixel
417417 for uid in unique_ids :
418418 if uid == - 1 : # Background/void
@@ -432,7 +432,7 @@ def id_map_to_rgb(
432432 rgb = color
433433 mask = id_map [:, :, id_index ] == uid
434434 img [mask ] = np .array (rgb ) / 255.0
435-
435+
436436 return img
437437
438438class PlotBase (IDManagerMixin ):
0 commit comments