gpt4 book ai didi

python - Matplotlib、Jupyter : Have annotation appearing when hovering over plot

转载 作者:行者123 更新时间:2023-12-05 08:33:20 26 4
gpt4 key购买 nike

我正在尝试使用 matplotlib 创建一个绘图,当将鼠标悬停在图表的某些元素上时会出现工具提示。我想在 Jupyter Notebook 中使用 python 3 执行此操作。

我试过这里提供的代码片段:

http://matplotlib.org/examples/event_handling/pick_event_demo.html
Possible to make labels appear when hovering over a point in matplotlib?
Is there a matplotlib equivalent of MATLAB's datacursormode?
Matplotlib basemap: Popup box

但是它们都不起作用。情节显示但不是互动的。我尝试使用和不使用魔法 %matplotlib inline 都没有效果。我当然也修改了没有括号的打印语句。
是否有特定的命令或后端可用于在 Jupyter 中进行交互?

编辑:使用 mpld3 的示例“有效”,但我宁愿坚持使用基本的 matplotlib。

最佳答案

我想你想要 %matplotlib notebook。这将在笔记本中集成交互式图表。

关于python - Matplotlib、Jupyter : Have annotation appearing when hovering over plot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41779063/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com