* Using Emacs to dsiplay interactive python plots with matplotlib
@ 2023-05-19 10:42 CNRS
2023-05-19 13:30 ` Eduardo Ochs
2023-05-28 3:20 ` James Thomas
0 siblings, 2 replies; 3+ messages in thread
From: CNRS @ 2023-05-19 10:42 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Using Emacs to dsiplay interactive python plots with matplotlib
2023-05-19 10:42 Using Emacs to dsiplay interactive python plots with matplotlib CNRS
@ 2023-05-19 13:30 ` Eduardo Ochs
2023-05-28 3:20 ` James Thomas
1 sibling, 0 replies; 3+ messages in thread
From: Eduardo Ochs @ 2023-05-19 13:30 UTC (permalink / raw)
To: CNRS; +Cc: help-gnu-emacs
On Fri, 19 May 2023 at 07:43, CNRS <valentin.poncet@cnrs.fr> wrote:
>
> 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
A related question:
are there any packages that 1) let Emacs talk to external programs
that do interactive plots and animations, and that 2) are
"hacker-friendly" in the sense that their innards are easy to
understand and easy to play with? In 2020 or 2021 I spent a few days
trying to learn how to use Jupyter Notebooks from Emacs, but I found
that there were too many layers (for me - my mental buffers are small,
sorry!) between the user interface and the low-level parts that I
mostly interested in...
Thanks in advance!
Eduardo Ochs
http://anggtwu.net/#eev
http://anggtwu.net/eepitch.html
http://anggtwu.net/2021-org-for-non-users.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Using Emacs to dsiplay interactive python plots with matplotlib
2023-05-19 10:42 Using Emacs to dsiplay interactive python plots with matplotlib CNRS
2023-05-19 13:30 ` Eduardo Ochs
@ 2023-05-28 3:20 ` James Thomas
1 sibling, 0 replies; 3+ messages in thread
From: James Thomas @ 2023-05-28 3:20 UTC (permalink / raw)
To: CNRS; +Cc: help-gnu-emacs
CNRS wrote:
> 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 ?
emacs-jupyter is a package that has experimental support for such
'widgets' (but I don't use it, and don't know how well-maintained it
is).
Perhaps in the future one could hope for an extension package for
comint-mime using emacs-eaf.
https://github.com/emacs-jupyter/jupyter
https://github.com/astoff/comint-mime
https://github.com/emacs-eaf
--
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-28 3:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-19 10:42 Using Emacs to dsiplay interactive python plots with matplotlib CNRS
2023-05-19 13:30 ` Eduardo Ochs
2023-05-28 3:20 ` James Thomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).