Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes you can use the module rc in matplotlib to do it. I just modified a sample file I had to illustrate it.

from matplotlib import rc from numpy import arange, cos, pi, sin, sqrt

import matplotlib.pyplot as plt
plt.rc('text', usetex=True)

plt.rc('font',**{'family':'serif','serif':['Computer Modern Roman'],'size':14})
fig = plt.figure(figsize=(4,2.7))
ax = fig.add_subplot(111)
t = arange(0.0, 1.0+0.01, 0.01)
u = 1/sqrt(t*t+1)

p2=plt.plot(t, u,'g-',label=r'$\frac{1}{\sqrt{x^2+1}}$')
l1=plt.legend(loc=1, borderaxespad=0.)
l1.draw_frame(0)

fig.subplots_adjust(left=0.17,bottom=0.20,right=0.96,top=0.95)
plt.xlabel(r'{time (s)}')
plt.ylabel(r'{voltage (mV)}')
labels = ax.get_xticklabels()

plt.savefig('tex_demo.eps')

plt.show()

Yes you can use the module rc in matplotlib to do it. I just modified a sample file I had to illustrate it.

from matplotlib import rc
from numpy import arange, cos, pi, sin, sqrt

sqrt
import matplotlib.pyplot as plt
plt.rc('text', usetex=True)

plt.rc('font',**{'family':'serif','serif':['Computer Modern Roman'],'size':14})
fig = plt.figure(figsize=(4,2.7))
ax = fig.add_subplot(111)
t = arange(0.0, 1.0+0.01, 0.01)
u = 1/sqrt(t*t+1)

p2=plt.plot(t, u,'g-',label=r'$\frac{1}{\sqrt{x^2+1}}$')
l1=plt.legend(loc=1, borderaxespad=0.)
l1.draw_frame(0)

fig.subplots_adjust(left=0.17,bottom=0.20,right=0.96,top=0.95)
plt.xlabel(r'{time (s)}')
plt.ylabel(r'{voltage (mV)}')
labels = ax.get_xticklabels()

plt.savefig('tex_demo.eps')

plt.show()