在python中删除标题

在python中删除标题,python,plotly,Python,Plotly,如何删除下面图片中的标题 我想删除顶轴标题,因为它们是多余的,太长的图片 这是我正在使用的代码: import plotly.express as px fig = px.box(DF.melt(), y="value", facet_col="variable", boxmode="overlay", color="variable") fig.update_yaxes(matches=None) for i

如何删除下面图片中的标题

我想删除顶轴标题,因为它们是多余的,太长的图片

这是我正在使用的代码:

import plotly.express as px

fig = px.box(DF.melt(), y="value", facet_col="variable", boxmode="overlay", color="variable")
fig.update_yaxes(matches=None)

for i in range(len(fig["data"])):
    yaxis_name = 'yaxis' if i == 0 else f'yaxis{i + 1}'
    fig.layout[yaxis_name].showticklabels = True
    #fig.update_layout(showlegend=False)


fig.update_layout(legend = dict(bgcolor = 'white'))
fig.update_layout(plot_bgcolor='white')

fig.update_xaxes(showline=True, linewidth=2, linecolor='black')#, mirror=True)
fig.update_yaxes(showline=True, linewidth=2, linecolor='black')#, mirror=True)

fig.update_xaxes(showgrid=True, gridwidth=1, gridcolor='gray')
fig.update_yaxes(showgrid=True, gridwidth=1, gridcolor='gray')

fig.show()

您必须迭代标签以将文本更新为空“”。 在代码中包含以下内容:

fig.for_each_annotation(lambda a: a.update(text=""))

这是一个

我想这个问题在这篇文章中得到了回答。