@WindChimes, fig['layout']['annotations']is a list. Hence you should extend that list, in order to preserve the annotations defined when the fig was created (particularly subplot_titles).
fig['layout']['annotations'].extend( [
go.Annotation(
x = 0.5,
y = -0.2,
showarrow=False,
text=“Text”,
xref=“paper”,
yref=“paper”
),
go.Annotation(
x = -0.05,
y = 0.15,
showarrow=False,
text=“Text”,
xref=“paper”,
yref=“paper”,
textangle=-90
)])
@mixy Before choosing the annotation position you should inspect the domain for x and y-plot coordinates in each subplot, as it is explained in this notebook https://plot.ly/~empet/14826.
@empet, Thanks for your response. It is still not 100% clear how to get both the subplot titles and the new annotation.
Should I start by creating the subplot titles, then convert fig.layout.annotations to a list (instead of a tuple), and finally extend with my new annotation?
@agplot, You should proceed as follows:
Don’t pass subplot_titles to tls.make_subplotst().
Then define annotations as I mentioned in the previous answer, where you include both annotations for titles, and other annotations you intended to add before as updates. When the lists of annotations is complete, then you update the fig.layout with:
Hi there, I just encountered the same problem as mentioned in this thread but
fig[“layout”][“annotations”] += [{…}]
did not work for me but
fig[“layout”][“annotations”] += ({…})