Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40f83ab

Browse files
committed
added unicode demo for usetex
svn path=/trunk/matplotlib/; revision=3280
1 parent 6f5da53 commit 40f83ab

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

examples/tex_unicode_demo.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env python
2+
# -*- coding: latin-1 -*-
3+
"""
4+
This demo is tex_demo.py modified to have unicode. See that file for
5+
more information.
6+
"""
7+
from matplotlib import rcParams
8+
rcParams['text.usetex']=True
9+
rcParams['text.latex.unicode']=True
10+
from matplotlib.numerix import arange, cos, pi
11+
from pylab import figure, axes, plot, xlabel, ylabel, title, \
12+
grid, savefig, show
13+
14+
figure(1)
15+
ax = axes([0.1, 0.1, 0.8, 0.7])
16+
t = arange(0.0, 1.0+0.01, 0.01)
17+
s = cos(2*2*pi*t)+2
18+
plot(t, s)
19+
20+
xlabel(r'\textbf{time (s)}')
21+
s = unicode(r'\textit{Velocity (°/sec)}','latin-1')
22+
ylabel(unicode(r'\textit{Velocity (°/sec)}','latin-1'),fontsize=16)
23+
title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
24+
fontsize=16, color='r')
25+
grid(True)
26+
savefig('tex_demo')
27+
28+
29+
show()

0 commit comments

Comments
 (0)