Annotation fixed alignment with arrow


#1

The normal align keyword for annotation text is only applicable to the alignment of multiline text. But what would be nice is if this keyword (or another one?) could be used to fix the position on the page and make the length of the arrow variable to accommodate. Right now it’s vice versa.

My use case:
I have multiple annotations stacked vertically and I want an easy way to make the text in them horizontally aligned. They all have arrows pointing to different things.


#2

Hi @jmason86,

I’m not sure if it will get you all the way to the solution you’re picturing, but have you tried the xanchor property? This controls where the arrow tail starts with respect the the text, and so you could use it to line up one edge of the text.

import plotly.graph_objs as go
fig = go.FigureWidget({
    'data': [],
    'layout': {'annotations': [{'text': 'First One',
                                'xanchor': 'right',
                                'y': 1},
                               {'text': 'Second',
                                'xanchor': 'right',
                                'y': 2}]}
})
fig

-Jon