Not strictly a Latex issue, but I'm asking here as I'm using python to render images for my latex document with a matching font (palatino) and wondered if any of you had had similar trouble.

I have an ordinary graph and when trying to add a Chi-squared symbol \chi, it keeps coming out as a \phi symbol instead. I can see there is a similar issue in latex, but I can't seem to find any help for this issue in python. (Palatino, roman \chi and the math mode)

Any help appreciated, H

  • 1
    (1) welcome, (2) We probably need some more information about what exactly you are doing. I have often used python to generate the data for my plots, but then use LaTeX to make the actual plot, using pgfplots. Then the fonts are a non issue, if combined with the standalone classs, those graphs can then be used in other applocations.
    – daleif
    Jan 24, 2018 at 10:38
  • Thank you for your speedy response. I am quite far into writing my thesis now and changing my graphing software wouldn't be ideal. I am using the following code to get the correct font within python "from matplotlib import rc rc('font',**{'family':'serif', 'serif':['Palatino'], 'size' : 12}) rc('text', usetex=True) " and then simply including the following line in my plot declaration: plt.text(1, 4500, r"$\mathrm{\sum{\chi_v^2}}$ =", size=20). (I apologise for the messy text here, I'm still learning how to use this site properly!) H
    – HMODP
    Jan 24, 2018 at 10:44
  • 1
    Update your question with the data. I'm not that part into python to know much about matplotlib, but note that Palatino is a text font, thus contains no math, and how exactly dshould python interpret embedded LaTeX code? There are some packages that provides math for palatino, mathpazo is one.
    – daleif
    Jan 24, 2018 at 11:00
  • 1
    I changed it to 'mathpazo' and the error has disappeared. I didn't realise that the mathpazo was the maths/greek font that goes with palatino. Thank you for your help.
    – HMODP
    Jan 24, 2018 at 11:23

1 Answer 1


I have no idea how pythons matplotlib uses LaTeX for labels in graph making (I tend to just make data in python, and use pgfplots to plot it).

But, Palatino is a text font, it contains no math charaters. So you probably need a math font. One LaTeX example us the mathpazo package, which changes the latex text font to palatino and provides a suitable math font.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .