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?

2
  • 1
    %matplotlib notebook (comes with matplotlib) or %matplotlib widget (needs ipympl installed) Commented Feb 13, 2019 at 14:10
  • thanks, that was very helpful for a jupyter beginner. For the alternatives I found at medium.com/@1522933668924/… 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. Commented Feb 13, 2019 at 20:39

1 Answer 1

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()
Sign up to request clarification or add additional context in comments.

1 Comment

This seems to encounter the error: "/usr/local/lib/python3.10/dist-packages/mpld3/mplexporter/utils.py in get_grid_style(axis) AttributeError: 'XAxis' object has no attribute '_gridOnMajor'"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.