Automatically determine label color based on background color
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.8k
- Forks
- 254
- Avg merge
- 10h 35m
- Merged PRs (30d)
- 9
Description
In plots with inline text (labels), the text must be legible at all times, this entails changing the font color based on the background color.
The current workaround also advertised in the docs is to insert a new column into the dataframe that directly maps the color based on some threshold.
Since plotnine is responsible for mapping background colors, it could compute the font color for labels ad-hoc based on the background color such that it is always legible.
This would make the library more ergonomic for me. Currently, I spend more time than I would like to admit manually adjusting the threshold.
Contributor guide
No contributing guide indexed for this repository
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 with the annotated heatmap example linked in the issue and trace how plotnine maps background colours and renders inline labels. Determine the legibility rule and where an automatic font-colour choice belongs; done means labels remain legible across mapped backgrounds without the dataframe workaround, with coverage for relevant cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100