plot.ly 悬停框大小属性

plot.ly Hover Box Size attribute

我正在使用 plot.ly Python api,但不知道如何调整 plotly 悬停框的大小。

例如,在下面的可视化中,CollegeClass.... 的标签被截断了。我想调整悬停框中字符串的长度。

您可能找到了答案,因为:

通过设置 'text' 并将其传递给您的 hoverinfo。 在您的示例中,如果您设置 text='CollegeClass' 并设置您的 hoverinfo = 'text' 您将得到您期望的结果。 跟踪的名称似乎被截断了,而您传递的文本或标签却没有。

data = [
go.Scatter(
    x=[0, 1, 2],
    y=[1, 3, 2],
    mode='markers',
    text=['Text A', 'Text B', 'Text C']
    hoverinfo = 'text'
)]

复制自https://plot.ly/python/text-and-annotations/#adding-hover-text-to-data-in-line-and-scatter-plots 并不是说在我的情况下我必须设置 hoverinfo = 'text' 而在这个例子中它似乎没有。

我可能来晚了一点,但我找到了连击解决方案 将 hoverlabel: {namelength :-1} 添加到我的跟踪对象中就成功了。

来自Here