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

Skip to content

Commit 4c1404a

Browse files
committed
Merge pull request #4670 from jenshnielsen/MEP12_usetex
Mep12 usetex
2 parents e405a68 + 2acfe38 commit 4c1404a

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,70 @@
11
import matplotlib
22
matplotlib.rc('text', usetex=True)
3-
import pylab
3+
import matplotlib.pyplot as plt
44
import numpy as np
55

66
# interface tracking profiles
77
N = 500
88
delta = 0.6
99
X = np.linspace(-1, 1, N)
10-
pylab.plot(X, (1 - np.tanh(4.*X/delta))/2, # phase field tanh profiles
10+
plt.plot(X, (1 - np.tanh(4.*X/delta))/2, # phase field tanh profiles
1111
X, (X + 1)/2, # level set distance function
1212
X, (1.4 + np.tanh(4.*X/delta))/4, # composition profile
1313
X, X < 0, 'k--', # sharp interface
1414
linewidth=5)
1515

1616
# legend
17-
pylab.legend((r'phase field', r'level set', r'composition', r'sharp interface'), shadow=True, loc=(0.01, 0.55))
17+
plt.legend(('phase field', 'level set', 'composition', 'sharp interface'), shadow=True, loc=(0.01, 0.55))
1818

19-
ltext = pylab.gca().get_legend().get_texts()
20-
pylab.setp(ltext[0], fontsize=20, color='b')
21-
pylab.setp(ltext[1], fontsize=20, color='g')
22-
pylab.setp(ltext[2], fontsize=20, color='r')
23-
pylab.setp(ltext[3], fontsize=20, color='k')
19+
ltext = plt.gca().get_legend().get_texts()
20+
plt.setp(ltext[0], fontsize=20, color='b')
21+
plt.setp(ltext[1], fontsize=20, color='g')
22+
plt.setp(ltext[2], fontsize=20, color='r')
23+
plt.setp(ltext[3], fontsize=20, color='k')
2424

2525
# the arrow
2626
height = 0.1
2727
offset = 0.02
28-
pylab.plot((-delta / 2., delta / 2), (height, height), 'k', linewidth=2)
29-
pylab.plot((-delta / 2, -delta / 2 + offset * 2), (height, height - offset), 'k', linewidth=2)
30-
pylab.plot((-delta / 2, -delta / 2 + offset * 2), (height, height + offset), 'k', linewidth=2)
31-
pylab.plot((delta / 2, delta / 2 - offset * 2), (height, height - offset), 'k', linewidth=2)
32-
pylab.plot((delta / 2, delta / 2 - offset * 2), (height, height + offset), 'k', linewidth=2)
33-
pylab.text(-0.06, height - 0.06, r'$\delta$', {'color': 'k', 'fontsize': 24})
28+
plt.plot((-delta / 2., delta / 2), (height, height), 'k', linewidth=2)
29+
plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height - offset), 'k', linewidth=2)
30+
plt.plot((-delta / 2, -delta / 2 + offset * 2), (height, height + offset), 'k', linewidth=2)
31+
plt.plot((delta / 2, delta / 2 - offset * 2), (height, height - offset), 'k', linewidth=2)
32+
plt.plot((delta / 2, delta / 2 - offset * 2), (height, height + offset), 'k', linewidth=2)
33+
plt.text(-0.06, height - 0.06, r'$\delta$', {'color': 'k', 'fontsize': 24})
3434

3535
# X-axis label
36-
pylab.xticks((-1, 0, 1), ('-1', '0', '1'), color='k', size=20)
36+
plt.xticks((-1, 0, 1), ('-1', '0', '1'), color='k', size=20)
3737

3838
# Left Y-axis labels
39-
pylab.ylabel(r'\bf{phase field} $\phi$', {'color': 'b',
39+
plt.ylabel(r'\bf{phase field} $\phi$', {'color': 'b',
4040
'fontsize': 20})
41-
pylab.yticks((0, 0.5, 1), ('0', '.5', '1'), color='k', size=20)
41+
plt.yticks((0, 0.5, 1), ('0', '.5', '1'), color='k', size=20)
4242

4343
# Right Y-axis labels
44-
pylab.text(1.05, 0.5, r"\bf{level set} $\phi$", {'color': 'g', 'fontsize': 20},
44+
plt.text(1.05, 0.5, r"\bf{level set} $\phi$", {'color': 'g', 'fontsize': 20},
4545
horizontalalignment='left',
4646
verticalalignment='center',
4747
rotation=90,
4848
clip_on=False)
49-
pylab.text(1.01, -0.02, "-1", {'color': 'k', 'fontsize': 20})
50-
pylab.text(1.01, 0.98, "1", {'color': 'k', 'fontsize': 20})
51-
pylab.text(1.01, 0.48, "0", {'color': 'k', 'fontsize': 20})
49+
plt.text(1.01, -0.02, "-1", {'color': 'k', 'fontsize': 20})
50+
plt.text(1.01, 0.98, "1", {'color': 'k', 'fontsize': 20})
51+
plt.text(1.01, 0.48, "0", {'color': 'k', 'fontsize': 20})
5252

5353
# level set equations
54-
pylab.text(0.1, 0.85,
54+
plt.text(0.1, 0.85,
5555
r'$|\nabla\phi| = 1,$ \newline $ \frac{\partial \phi}{\partial t}'
5656
r'+ U|\nabla \phi| = 0$',
5757
{'color': 'g', 'fontsize': 20})
5858

5959
# phase field equations
60-
pylab.text(0.2, 0.15,
60+
plt.text(0.2, 0.15,
6161
r'$\mathcal{F} = \int f\left( \phi, c \right) dV,$ \newline '
6262
r'$ \frac{ \partial \phi } { \partial t } = -M_{ \phi } '
6363
r'\frac{ \delta \mathcal{F} } { \delta \phi }$',
6464
{'color': 'b', 'fontsize': 20})
6565

6666
# these went wrong in pdf in a previous version
67-
pylab.text(-.9, .42, r'gamma: $\gamma$', {'color': 'r', 'fontsize': 20})
68-
pylab.text(-.9, .36, r'Omega: $\Omega$', {'color': 'b', 'fontsize': 20})
67+
plt.text(-.9, .42, r'gamma: $\gamma$', {'color': 'r', 'fontsize': 20})
68+
plt.text(-.9, .36, r'Omega: $\Omega$', {'color': 'b', 'fontsize': 20})
6969

70-
pylab.show()
70+
plt.show()

0 commit comments

Comments
 (0)