0

I was trying to use Emacs as my editor for my research (I followed all steps in Jon Fincher’s guide on Realpython : [https://realpython.com/emacs-the-best-python-editor/]).

I use jupyter notebooks a lot for data visualization, so I installed ein [https://github.com/millejoh/emacs-ipython-notebook]. I can use my virtual environment in Emacs (pyvenv-workon), open my notebook run all the cells fine : until I launch a cell with a maptlotlib plot.

In jupyter to have an interactive plot I put « %matplotlib nbagg » in my code cell and it works just fine. In Emacs it prints « <IPython.core.display.Javascript object » but it does not display it. If I do « %matplotlib inline », it opens a .png file in my image viewer but I do not have the features of an interactive plot.

In an ideal world I would also like to be able to see a matplotlib anmation.

I browsed a bit and I think I understood that Emacs could not work with Javascript objects, is that correct ? A possible workaround for me would be to have the interactive plot in a seperate window but I did not find how to do that, is there some wiki I missed ?

Cheers

· %matplotlib nbagg returns an interactive figure in jupyter notebook browser interface, seems not to work in Emacs.

· plt.ion() should give interactive access does nothing.

· %matplotlb inline opens a non-interactive .png file with the plot

valentin
  • 1
  • 1
  • That pretty much sums it up. It would not be impossible to build a similar facility in Emacs Lisp but I am not aware of any attempt to do so. – tripleee May 05 '23 at 09:47
  • @tripleee thanks. Well that’s super sad then, no Emacs for me. I’ll stick to jupyterlab. – valentin May 05 '23 at 12:01
  • "A possible workaround for me would be to have the interactive plot in a separate window" -- if you mean it would be acceptable for a separate (not Emacs) GUI program to render the interactive graph, I don't see why you couldn't have that. Emacs can certainly run other programs, so the main thing you need is something which knows how to render the kinds of "interactive plot" that you're generating. As you're talking about Javascript, I suppose you want to run a web browser to do that. – phils May 05 '23 at 12:45
  • 1
    Here's one example of Emacs talking to a web browser to display a fancy visualisation: https://www.youtube.com/watch?v=3H38Yglw1dU . I don't use any of this stuff myself, so I'm afraid I have no specific pointers, but I wanted to clarify that this much would be possible. – phils May 05 '23 at 12:55

0 Answers0