forked from rougier/matplotlib-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.py
More file actions
40 lines (32 loc) · 1.45 KB
/
Copy pathtext.py
File metadata and controls
40 lines (32 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from pylab import *
fig = plt.figure()
plt.xticks([]),plt.yticks([])
eqs = [
"$W^{3\\beta}_{\\delta_1 \\rho_1 \\sigma_2} = U^{3\\beta}_{\\delta_1 \\rho_1} + \\frac{1}{8 \\pi 2} \\int^{\\alpha_2}_{\\alpha_2} d \\alpha^\\prime_2 \\left[\\frac{ U^{2\\beta}_{\\delta_1 \\rho_1} - \\alpha^\\prime_2U^{1\\beta}_{\\rho_1 \\sigma_2} }{U^{0\\beta}_{\\rho_1 \\sigma_2}}\\right]$",
"$\\frac{d\\rho}{d t} + \\rho \\vec{v}\\cdot\\nabla\\vec{v} = -\\nabla p + \\mu\\nabla^2 \\vec{v} + \\rho \\vec{g}$",
"$\\int_{-\\infty}^\\infty e^{-x^2}dx=\\sqrt{\\pi}$",
"$E = mc^2 = \\sqrt{{m_0}^2c^4 + p^2c^2}$",
"$F_G = G\\frac{m_1m_2}{r^2}$",
]
for _ in range(24):
index = np.random.randint(0,len(eqs))
eq = eqs[index]
size = np.random.uniform(12,32)
x,y = np.random.uniform(0,1,2)
alpha = np.random.uniform(0.25,.75)
text(x, y, eq, ha='center', va='center', color="#11557c", alpha=alpha,
transform=gca().transAxes, fontsize=size, clip_on=True)
text(-0.05, 1.05, " Text \n\n",
horizontalalignment='left',
verticalalignment='top',
family='Lint McCree Intl BB',
size='x-large',
bbox=dict(facecolor='white', alpha=1.0, width=350,height=60),
transform = gca().transAxes)
text(-0.05, .975, " Draw any kind of text ",
horizontalalignment='left',
verticalalignment='top',
family='Lint McCree Intl BB',
size='medium',
transform = gca().transAxes)
plt.savefig('../figures/text.png', dpi=64)