0

I want to save the following figure as svg without rendered LaTex code:

import numpy as np
import matplotlib.pyplot as plt
plt.plot(np.arange(10))
plt.title(r'$\alpha$')
plt.savefig('figure.svg', format='svg')

Instead of $\alpha$ I see a rendered alpha-symbol in the title. How can I change this such that the LaTeX code is not rendered?

enter image description here

Bax Menker
  • 41
  • 1
  • 9

1 Answers1

1

The solution is to escape the dollar signs with \$ and since my workflow is pyplot > inkscape > latex, I have to set the correct matplotlibrc parameters:

import numpy as np
import matplotlib.pyplot as plt
import matplotlib
rc_params = {'text.usetex': 'False', 'svg.fonttype': 'none'}
matplotlib.rcParams.update(rc_params)
plt.plot(np.arange(10))
plt.title(r'\$\alpha\$')
plt.savefig('figure.svg', format='svg')
Bax Menker
  • 41
  • 1
  • 9