0

Within Google-colaboratory, I cannot use matplotlib. use(TkAgg).

The possibility that it offers to me is though very helpful:

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.

Is there anything similar within iPython / Jupyter that has a similar functionality?

user7468395
  • 1,299
  • 2
  • 10
  • 23
  • 1
    `%matplotlib notebook` (comes with matplotlib) or `%matplotlib widget` (needs [ipympl](https://github.com/matplotlib/jupyter-matplotlib) installed) – ImportanceOfBeingErnest Feb 13 '19 at 14:10
  • thanks, that was very helpful for a jupyter beginner. For the alternatives I found at https://medium.com/@1522933668924/using-matplotlib-in-jupyter-notebooks-comparing-methods-and-some-tips-python-c38e85b40ba1 presently only `!pip install mpld3` `import mpld3` `mpld3.enable_notebook()` does offer some functionality (namely: zooming and moving the plot). A value help for the hovered mouse is missing though. – user7468395 Feb 13 '19 at 20:39

1 Answers1

1

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()
user7468395
  • 1,299
  • 2
  • 10
  • 23