【问题标题】:How can I align multiple line plot titles?如何对齐多个线图标题?
【发布时间】:2021-12-12 14:02:02
【问题描述】:

目前我使用 plotly 并且当我使用多行标题时它看起来不太好,它没有对齐。有没有办法正确对齐它们?

这就是现在的样子:

import pandas as pd
import plotly.express as px
s = pd.Series(np.random.randn(5), index=["a", "b", "c", "d", "e"])
fig = px.line(s, title='This is a fantasy dataset <br> Why is this line not aligned with the text above?')
fig.show

输出:

【问题讨论】:

  • 您在&lt;br&gt; 之后使用了空白。删除后你有你想要的吗?

标签: python pandas plotly


【解决方案1】:

Why 之前有一个空格,删除它会使行与顶行对齐。

import pandas as pd
import plotly.express as px
import numpy as np
s = pd.Series(np.random.randn(5), index=["a", "b", "c", "d", "e"])
fig = px.line(s, title='This is a fantasy dataset <br>Why is this line not aligned with the text above?')
fig.show()

&lt;br /&gt; 后面不应该有空格。

这输出为 -

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-04
    • 1970-01-01
    • 2015-05-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-18
    • 2013-05-31
    • 2013-10-08
    相关资源
    最近更新 更多