plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
15.62k stars 2.51k forks source link

Add axis domain as an option for position legends #4601

Open juan11iguel opened 1 month ago

juan11iguel commented 1 month ago

This is related to this question in the community forum. Opened an issue since I think this is a better place for a feature request.

In short, enabling arbitrary axis as a reference system for legends would greatly simplify its positioning along different axis in order to achieve a legend per plot in a figure with subplots. Currently is only supported for shapes, annotations, and images:

Furthermore, shapes, annotations, and images can be placed relative to an axis's domain so that, for instance, an x value of 0.5 would place the object halfway along the x-axis, regardless of the domain as specified in the layout.xaxis.domain attribute. This behavior can be specified by adding ' domain' to the axis reference in the axis referencing attribute of the object. For example, setting yref = 'y2 domain' for a shape will refer to the length and position of the axis named y2.