MaartenGr / MaartenGr/BERTopic
Cannot Implement Multi-color Intertopic Distance Map Visualization
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
Hello,
I'm trying to customize the intertopic distance map in BERTopic to show different color bubbles for each topic. I've attempted to modify the _topic.py file to include Seaborn's color palette but haven't achieved the desired effect. I am wondering how best to proceed.
My Approach
Here is the relevant section of code I modified in the _topic.py file to support multi-color visualization:
```
# I added this code to generate different colours
color_palette = sns.color_palette("hsv", len(topics)).as_hex()
# ... continued with other parts of the code
df = pd.DataFrame({"x": embeddings[:, 0], "y": embeddings[:, 1],
"Topic": topic_list, "Words": words, "Size": frequencies, "Color": color_palette})
```
I did not see any change in the colors of the bubbles after running this modified code.
What I Expected:
I expected to see each bubble in the intertopic distance map with a unique color, as defined by the Seaborn's color palette.
What Happened:
However, the colors in the intertopic distance map remained unchanged.
Questions:
Is the _topic.py the correct place to modify for customizing colors in the intertopic distance map?
Are there specific steps or methods within BERTopic that I need to utilize to change the colors effectively?
Could you guide me on how to modify the code so that it would achieve the desired multi-color visualization?
Thank you for your time and consideration. I look forward to your guidance to resolve this issue.
Best regards,
Paris Kang

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in _topic.py and trace how the intertopic distance map assigns bubble colors after the DataFrame is created. Compare the requested Seaborn palette with the visualization path; done means each topic bubble displays a distinct color without changing the map's existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100