Python可视化之草稿图
import numpy as np
import matplotlib.pyplot as plt
from pylab import mpl
mpl.rcParams['font.sans-serif']=['SimHei']
eqs = []
eqs.append((r"考研必胜"))
eqs.append((r"一起加油鸭"))
eqs.append((r"熬过黑夜都是日出"))
eqs.append((r"顺利上岸"))
plt.axes([0.025,0.025,0.95,0.95])
for i 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)
plt.text(x, y, eq, ha='center',va='center',color="#00fbb0",alpha=alpha,
transform=plt.gca().transAxes,fontsize=size,clip_on=True)
plt.xticks([]),plt.yticks([])
plt.show()
图片