缩放并在iPython中使用光标绘制matplotlib图 [英] Zoom and have cursor for a matplotlib plot within iPython
本文介绍了缩放并在iPython中使用光标绘制matplotlib图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Google协作范围内,我无法使用matplotlib. use(TkAgg)
.
Within Google-colaboratory, I cannot use matplotlib. use(TkAgg)
.
它为我提供的可能性非常有帮助:
The possibility that it offers to me is though very helpful:
我可以交互放大绘图,还可以得到一个光标,向我显示鼠标悬停在其中的x和y的当前值.
I can zoom in my plot interactively and also get a cursor that shows me the present values of x and y where my mouse is hovering over.
iPython/Jupyter中是否存在具有相似功能的相似内容?
Is there anything similar within iPython / Jupyter that has a similar functionality?
推荐答案
有了这些代码段,缩放和鼠标X/Y光标悬停在Google Colab中都可以使用:
With these snippet, both zooming and the hovered mouse x/y cursor works in google colab:
!pip install mpld3
!pip install "git+https://github.com/javadba/mpld3@display_fix"
import mpld3
from mpld3 import plugins
fig, ax = plt.subplots()
ax.plot(a, "-o", markersize=2)
plugins.connect(fig, plugins.MousePosition(fontsize=14))
mpld3.display()
这篇关于缩放并在iPython中使用光标绘制matplotlib图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文