When I create a scatter plot, and specify to show hovertext by passing
hovertext=my_text, hoverinfo='text' to
Scatter, the hoverinfo box has the same background color as the marker it is attached to, and the font color is chosen automatically to have good contrast with the background in order to be readable. I love this feature!!
I would love to have this ability for other objects too, e.g. for the text of a marker itself, or general annotations. Is there something like
color=automatic to achieve this?
Yeah, the auto-coloring of tooltip text is pretty cool
I don’t of this feature being available elsewhere, but I like the sound of it. I think this would be a fine feature request for the Plotly.js project https://github.com/plotly/plotly.js/issues (this kind of change would need to flow through Plotly.js before making it to plotly.py)
In the meantime, if you compute the rgb color values yourself, you could use the color contrast formula from w3: https://www.w3.org/TR/AERT/#color-contrast.
Thanks for the quick answer! I see, I will make a feature request there then
Thanks also for the link, that formula is indeed helpful and can fix my issue for now, great!