【问题标题】:How to format plotly title in python as bold when the title is a variable?当标题是变量时,如何将python中的绘图标题格式化为粗体?
【发布时间】:2020-02-13 03:17:42
【问题描述】:

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

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

但是如果将标题分配给变量,我该如何让它工作呢?

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

【问题讨论】:

标签: python plotly


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-01-22
    • 1970-01-01
    • 2016-12-31
    • 2020-11-28
    • 1970-01-01
    • 2021-09-29
    • 1970-01-01
    相关资源
    最近更新 更多