在 iPython 范围内缩放并使用 matplotlib 图的光标
Zoom and have cursor for a matplotlib plot within iPython
在 Google-colaboratory 中,我无法使用 matplotlib. use(TkAgg)
。
它提供给我的可能性非常有帮助:
我可以交互式地放大我的绘图,还可以得到一个光标,显示我鼠标悬停的 x 和 y 的当前值。
iPython/Jupyter 中是否有类似的功能?
使用这些代码片段,缩放和悬停鼠标 x/y 光标都可以在 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()
在 Google-colaboratory 中,我无法使用 matplotlib. use(TkAgg)
。
它提供给我的可能性非常有帮助:
我可以交互式地放大我的绘图,还可以得到一个光标,显示我鼠标悬停的 x 和 y 的当前值。
iPython/Jupyter 中是否有类似的功能?
使用这些代码片段,缩放和悬停鼠标 x/y 光标都可以在 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()