MaartenGr / MaartenGr/BERTopic

Orientation in barchart visualization

Open
#1,500 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.8k
Forks
920
Avg merge
22h 24m
Merged PRs (30d)
5

Description

Hello Maarten,
First of all, thank you very much for this wonderful model. I really enjoy using it and manipulating my data through it.

I was wondering if it is possible to choose the orientation of the barchart in visualize_topics_per_class for example ? In order to create a dashboard from the visualizations from bertopic, I think it could be nice to have this possibility.

I took your visualize_topics_per_class method and add a parameter "orient" (default "h" for horizontal) and modify a line in it :

` fig.add_trace(go.Bar(y=trace_data.Class,
x=x,`

by

` fig.add_trace(go.Bar(y=trace_data.Class if orient == "h" else x,
x=x if orient == "h" else trace_data.Class,`

In this case anything other value than 'h' will print my barchart vertically, I can of course be more precise letting only "v" to work and add an exception otherwise.

It works well, it's simple. I am just "afraid" that in the future you modify the visualize_topics_per_class and I'm not going to take advantage of it because I'm using my modified function.

it's just an idea and I'm sure you have plenty of other information and priorities to decide whether it's worth it or not.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the visualize_topics_per_class entry point and review how its go.Bar trace is assembled. Add a documented orientation option covering the requested horizontal and vertical layouts, then verify both orientations render correctly and that the default remains horizontal.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.