diff --git a/src/lenses/BoundingBoxLens/index.tsx b/src/lenses/BoundingBoxLens/index.tsx index 139d5b2a..7fb0d558 100644 --- a/src/lenses/BoundingBoxLens/index.tsx +++ b/src/lenses/BoundingBoxLens/index.tsx @@ -101,8 +101,15 @@ const BoundingBoxLens: Lens = ({ urls, values, columns }) => { if (colorTransferFunction !== undefined) { colorFunc = (i: number) => colorTransferFunction(categories[i]).hex(); } else { - colorFunc = (i: number) => - colorPalette.scale().colors(categories.length)[i]; + colorFunc = (i: number) => { + const dtype = ( + columns[categoriesColumnIndex].type as SequenceDataType + ).dtype as CategoricalDataType; + const index = dtype.categories[invertedCategories(categories[i])]; + return colorPalette + .scale() + .colors(Object.keys(dtype.categories).length)[index]; + }; } }