Adding a border to plotly graph title

I am trying to put a border around a subheader of my plotly graph. I am trying the code below which works for my font size but itโ€™s not working for a border. Any one have any tips?

fig.update_layout(
            title=f'<span style="font-size: 20px">{title}</span>'
                  f'<br><span style="font-size:16px; border:solid black;"><b>Mean:</b> {y.mean():.2f} <b>Median:</b> {y.median():.2f} '
                  f'<b>Standard Deviation:</b> {y.std():.2f}</span>')

HI @bpolasek ,

I think this is similar to this topic - the style attributes affecting the text directly such as font-family, font-sizeโ€ฆ are processed but you canโ€™t use all html tags, but Iโ€™m not sure :wink:

Gotcha. Yeah Iโ€™ve found not all of them work. Was hoping there was another way around it without having to mess with annotations. Thanks!

If you find a way, please let me know :slight_smile:

1 Like