TeX $\times$ symbol not working in matplotlib?

gwhite gwhite at ti.com
Fri Apr 18 12:18:17 EDT 2014


Hi,

I am trying to understand how to get the TeX "\times" symbol to work.  It is in the title() string in the code I pasted in.  The "\circ" symbol seems fine, by comparison.  "\times" ends up as "imes" in the figure title.

I am probably doing something dumb (hey, maybe a lot of dumb things!), but if you can spot and describe my mistake, I would be quite happy about that.

Thank you.

# (Using Python 2.7.5 via pythonxy.  w7-64)

----------------------------------
import numpy as np
import matplotlib.pyplot as plt

Qs_rr = np.array([0.])
Qs_ri = np.array([0.])
Es_rr = np.array([-6.352844845095E-02,\
                  -6.352844845095E-02,\
                  -9.917112781473E-01,\
                  -1.008084892264E+00,\
                  -5.534164139252E-02,\
                  -5.534164139252E-02])
Es_ri = np.array([ 9.329580097745E-01,\
                  -9.329580097745E-01,\
                   0.000000000000E+00,\
                   0.000000000000E+00,\
                   1.070772729531E+00,\
                  -1.070772729531E+00]) 
plt.hold(False)
figs_open = plt.get_fignums()
axes_obj=plt.figure(figs_open[0]).gca()
lh1 = plt.plot(Qs_rr, Qs_ri, 'ro',\
               Es_rr, Es_ri, 'rx')
lh1[0].set_markerfacecolor('w')
lh1[0].set_markeredgecolor('r')
lh1[0].set_markersize(9.0)
lh1[0].set_markeredgewidth(0.75)
lh1[1].set_markersize(9.0)
lh1[1].set_markeredgewidth(0.75)
plt.axis([-1.2, 0.2, -1.2, 1.2])
plt.grid(True)
plt.title('$\mathrm{poles}$ $(\times)$ \
           $\mathrm{\&}$ $\mathrm{zeros}$ \
           $(\circ)$ $\mathrm{of}$ $T(s)T(-s)$',\
           fontsize=16)
plt.xlabel(r'$\sigma$', fontsize=16)
plt.ylabel(r'$\mathrm{j}\omega$', fontsize=16)
plt.show()



More information about the Python-list mailing list