我正在创建一个类似这样的条形图:
px.bar(df, x=x, y=y, color=c,
title=params['title'],
hover_data=hover_data)
当 c != None 时,图形会生成图例或颜色条。我怎样才能删除它们中的任何一个?
请您参考如下方法:
对于图例,您可以使用 fig.update_traces(showlegend=False) 或 fig.update(layout_showlegend=False)。
对于颜色条,您只能使用fig.update(layout_coloraxis_showscale=False)。在普通的 plotly 图形上,您也可以执行 fig.update_traces(marker_showscale=False),但它不适用于 plotly express,因为 facetted traces need to share the same colorscale .
