1

I would like to produce plots using matplotlib (through anaconda-spider installed on os x yosemite) and put labels on it not interpreted by tex. Here is the sample code:

# -*- coding: utf-8 -*-
import matplotlib.pyplot as pp
my_rc_param = {'text.usetex': False}
pp.figure()
pp.rcParams.update(my_rc_param)
pp.plot(range(10))
pp.xlabel('$x$')

I would like to see exactly the string $x$ as x label. In turn, I get the math-mode latex x. I have also tried, unsuccessfully, to put the following preamble:

from matplotlib import rc
rc('text', usetex=False) 

Is there a way to force a plain interpreter? Or should I consider this as a bug?

jijoe
  • 13
  • 1
  • 3

1 Answers1

3

You are not getting any latex mode. You are simply using the mathtex feature of matplotlib. Using latex is a different thing. I checked whether it is possible to switch off mathtex for matplotlib, and there is a quiet recent issue on this (see here). However, the way to sort out this problem consist is avoiding the math just escaping the $ symbol with '\':

pp.xlabel('\$x\$')

Just remove all the stuff related to the text.usetex as you are trying to do a complete different thing here.

Alejandro
  • 3,263
  • 2
  • 22
  • 38