I have been using org-mode with R in Spacemacs for a while now with no issue.

I'm moving my workflow from R to Python.

Jupyter notebooks (EIN) works great, but I prefer org-mode:

Normal (non-plot) blocks work well enough, but Emacs hangs when I try to plot using sessions (I can get it to plot if I don't use sessions).

I get a message that says, executing Python code block... that remains until I escape with C-g.

Here is an example of a function that won't print:

#+BEGIN_SRC python :session *Python*
import glob
from pandas import DataFrame, Series
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pandas.plotting import register_matplotlib_converters
import seaborn as sns
plt.rcParams["figure.figsize"] = (15, 10)

#+BEGIN_SRC python :session *Python* :results output drawer
units.pivot_table('A', 'B', 'C', aggfunc=len).fillna(0).plot()

I really want to use org-mode instead of notebooks. Any idea what I need to correct to make it work?


Try usimng ipython blocks instead of python (#+BEGIN_SRC ipython) and add the following line to your first source block:

%matplotlib inline

Note - I'm not sure if this will work with Spacemacs, but it is what scimax is all about. I used Spacemacs for about 6 months for python and jupyter notebooks before I switched to scimax for org-mode and never looked back.

| improve this answer | |

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.