Skip to content

Automatically determine label color based on background color #1013

@lucascherzer

Description

@lucascherzer

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions