【发布时间】:2019-12-20 11:42:09
【问题描述】:
当我将鼠标悬停在跨越区域上时,标签仅显示在跨越区域的两侧,而不是整个区域。
当我将鼠标悬停在标签上时,我希望在整个区域中查看标签。如何实现这个逻辑?
import matplotlib.pyplot as plt
import mplcursors
plt.axvspan(2,3,gid='yes',alpha=0.3,label = 'y')
mplcursors.cursor(hover=True).connect(
"add", lambda sel: sel.annotation.set_text(sel.artist.get_label()))
plt.show()
【问题讨论】:
标签: python-3.x matplotlib plot mplcursors