help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using Emacs to dsiplay interactive python plots with matplotlib


From: CNRS
Subject: Using Emacs to dsiplay interactive python plots with matplotlib
Date: Fri, 19 May 2023 12:42:33 +0200

Hello all,


I posted the following on stackoverflow [<https://stackoverflow.com/questions/76180861/is-it-possible-to-have-interactive-plots-in-emacs>], I thought maybe it’s more appropriate to ask it here, as you might have more knowledge on that matter and might not be using stack.


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/>] and learnt the basics with the tutorial).

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


What I tried :

· %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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]