我有一个情节图,我使用它将标题居中 -
fig.update_layout(
title={
'text' : title,
'x':0.5,
'xanchor': 'center'
})
Run Code Online (Sandbox Code Playgroud)
我有多个图表,我将其添加到每个图表中。我想知道是否可以提前定义它,例如使用配置对象或设置,而不是对每个图表都这样做。
Ham*_*zah 34
这对我来说很容易:
fig.update_layout(title_text='write a title here', title_x=0.5)
Run Code Online (Sandbox Code Playgroud)
您需要将“y 轴”的以下参数添加到您的字典中,正如文档提到的那样:
title = {
'text': "Plot Title",
'y':0.9, # new
'x':0.5,
'xanchor': 'center',
'yanchor': 'top' # new
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
30258 次 |
| 最近记录: |