You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Multi-line titles don't respond to title.yanchor #6472
When creating a multi-line title, eg. with <br> tags, the positioning doesn't seem to respect the title.yanchor parameter. See the example below where I would expect the full title to be positioned above the plot area. The title also stays in the same place when I change title.yanchor to top or middle.
It looks like this is due to errors in how the dy property of the SVG text is set (which is controlled from the API via yanchor). This function sets the dy for the .gtitle element, but text for multi-line titles is broken into tspan elements. It's looking like the children tspan elements don't have the dy set appropriately and I'm not sure where these values are coming from.
This bug still persists and the issue must be re-opened. @archmoj, @hannahker
Checked for Plotly.version "2.33.0".
Changing yanchor: "bottom" to yanchor: "top" in the code below has no effect.
Most importantly, from my perspective of a plotly.py user, there is no convenient way of "resting" a multi-line title precisely on top of the paper. One should keep guessing padding in pixels or percent, and then do over when a font size or height change. This is why this issue matters.
If I understand the semantics correctly, yanchor: "bottom" must line up the bottom of the bottom line with the position, and yanchor: "top" must line up the top of the top line.
JS code based on [Hannah's Codepen example](https://codepen.io/hannahker/pen/gOjyLEY)
Activity
archmoj commentedon Feb 7, 2023
Looks like a bug to me. @alexcjohnson what do you think?
hannahker commentedon Mar 14, 2023
It looks like this is due to errors in how the
dyproperty of the SVG text is set (which is controlled from the API viayanchor). This function sets thedyfor the.gtitleelement, but text for multi-line titles is broken intotspanelements. It's looking like the childrentspanelements don't have thedyset appropriately and I'm not sure where these values are coming from.avm19 commentedon Jun 25, 2024
This bug still persists and the issue must be re-opened. @archmoj, @hannahker
Checked for Plotly.version
"2.33.0".Changing
yanchor: "bottom"toyanchor: "top"in the code below has no effect.Most importantly, from my perspective of a plotly.py user, there is no convenient way of "resting" a multi-line title precisely on top of the paper. One should keep guessing padding in pixels or percent, and then do over when a font size or height change. This is why this issue matters.
If I understand the semantics correctly,
yanchor: "bottom"must line up the bottom of the bottom line with the position, andyanchor: "top"must line up the top of the top line.JS code based on [Hannah's Codepen example](https://codepen.io/hannahker/pen/gOjyLEY)