当标题是变量时,如何在python中将绘图标题格式化为粗体?

问题描述 投票:0回答:1

如果使用html标签将标题作为字符串输入,我知道如何将标题设置为粗体:

layout = go.Layout(title='<b>Bold</b>')

但是如果标题分配给变量,如何使它工作?

title = 'Bold'
layout = go.Layout(title='<b>'title'</b>')
python plotly
1个回答
0
投票

为了完整起见,我添加@SyntaxVoid注释作为有效的解决方案/答案。这有效:

title = 'Bold'
layout = go.Layout(title='<b>'+title+'</b>')
© www.soinside.com 2019 - 2024. All rights reserved.