gregsexton / ob-ipython

org-babel integration with Jupyter for evaluation of (Python by default) code blocks
737 stars 111 forks source link

Corrupted SVG output (wrong encoding) #179

Open nicolaroberto-tesla opened 6 years ago

nicolaroberto-tesla commented 6 years ago

TL;DR:

Without modifications of sort (on my system), evaluating ipython code to output an svg produces a corrupted file.

Include matplotlib.rcParams['axes.unicode_minus'] = False to solve.

Long Explanation:

The problem happens ONLY when the graph goes negative and only with INLINE output.

With a plt.savefig everything is right, but there will be no automated org output.

I tracked this issue back to the fact that there is something wrong with the file formatter for the INLINE procedure.

I found out that the problem is relative to this other issue: https://stackoverflow.com/questions/30201310/use-of-hyphen-or-minus-sign-in-matplotlib-versus-compatibility-with-latex

A system-wide solution is to just include matplotlib.rcParams['axes.unicode_minus'] = False somewhere at the beginning of the chain of python source blocks.

Cheers,

NRZ