0

I use emacs for most python programming, but really miss the inline plot feature combined with printed output in Spyder. See picture.

enter image description here

I've been experimenting with various interpreter settings but none seem to work:

(use-package python
  :config
  ;; (setq python-shell-interpreter "ipython"
       ;; python-shell-interpreter-args "-i --simple-prompt")
  (setq python-shell-interpreter "jupyter"
        python-shell-interpreter-args "console --simple-prompt"))

Is there a way to setup this functionality in Emacs?

1

You may wanna checkout ein. Also, spacemacs has a ipython-notebook layer setup based on that; perhaps you can use that as a reference for your own config.

0

Yes you can.

Try installing from the package-list ("M-x list-packages", it's in melpa) "emacs-jupyter" (or follow the instructions on the github, https://github.com/nnicandro/emacs-jupyter).

Then call a jupyter shell as "M-x jupyter-run-repl" (instead of the usual "M-x run-python").

You should be able to verify that it is working quickly (inside the shell you opened). A tip, when you are plotting: you want to say (in your python code) fig.set_facecolor('w') to make things more readable.

from matplotlib import pyplot as plt

fig = plt.figure(figsize=(10,10))
fig.set_facecolor('w')

plt.scatter([1,2,3], [4,5,3])
1
  • Wow thanks, this is amazing – simenojensen Nov 27 '20 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.