擅长:python、mysql、java
<p>还可以在数据框中创建新列,将其用作名称,并在工具提示中显示名称:</p>
<pre><code>fig = plt.figure()
def_tt = Tooltip(fields=['name'], show_labels=False)
df['labels'] = df.apply(lambda row: f'X: {row.x:%Y-%m-%d}, Y: {row.y:.2f}, Other Info: {row.custom_field}', axis=1)
scatt = plt.scatter(df.x, df.y, tooltip=def_tt,
# specify labels, but hide by default
names=df.labels, display_names=False)
fig
</code></pre>
<p><a href="https://i.stack.imgur.com/xe2YR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xe2YR.png" alt="enter image description here"/></a></p>
<p>但它不支持丰富的格式。甚至不换行:(</p>