plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

Refactor `add_vline()`, `add_hline()`, `add_hrect()`, `add_vrect()` to use Plotly.js `shape.label` attribute

Open emilykl opened this issue 2 months ago • 1 comments

The Plotly.py functions fig.add_vline(), fig.add_hline(), fig.add_hrect(), fig.add_vrect() accept arguments such as annotation_text which are used to create a label for the shape. This is done by creating and adding two separate objects to the Plotly.js layout: a shape, and an annotation.

However, now that Plotly.js has added support for shape labels, this is no longer necessary -- the text can be added directly as a label to the shape rather than creating two separate objects.

This would solve issues such as https://github.com/plotly/plotly.py/issues/3065 where we are doing some hacky stuff to get the label in the right place.

emilykl avatar Oct 09 '25 20:10 emilykl

I’m working in this. Thanks.

nochinxx avatar Nov 04 '25 05:11 nochinxx