import matplotlib.pyplot as plt
def plot_guy(x, y, frown=False, **plot_args):
an = array(linspace(0,2*pi,100))
head, = plot(cos(an)+x, sin(an)+y + 5, **plot_args)
body, = plot(array([0,0])+x, array([4,2])+y, **plot_args)
legs, = plot(array([-1,0,1])+x, array([0,2,0])+y, **plot_args)
arms, = plot(array([-1.5,0,1.5])+x, array([3.5,3,3.5])+y, **plot_args)
eye1, = plot(.2*cos(an)-.35 + x, .2*sin(an) + 5.2 + y, **plot_args)
eye2, = plot(.2*cos(an)+.35 + x, .2*sin(an) + 5.2 + y, **plot_args)
if frown:
mouth, = plot(cos(an[15:35]) + x, sin(an[15:35]) + 3.8 + y, **plot_args)
else:
mouth, = plot(cos(an[65:85]) + x, sin(an[65:85]) + 5.4 + y, **plot_args)
colors = plt.rcParams['axes.color_cycle']
guys = [[x,y, colors[randint(0,len(colors))]] for y in 50-arange(0,50,7) for x in arange(0,50,5)]
frown = lambda c: c == 'r'
fig, ax = subplots(figsize=(4,4))
for x, y, c in guys:
x += random_sample()*2
y += random_sample()*2
plot_args = dict(c=c, mec="b", mfc="w", lw=1, mew=3, ms=10)
plot_guy(x, y, frown(c), **plot_args)
ax.set_frame_on(False)
ax.set_xticks([])
ax.set_yticks([])
fig.tight_layout()
guys2 = [[x,y, random_sample()] for y in 50-arange(0,50,7) for x in arange(0,50,5)]
frown = lambda c: c < .2
fig, ax = subplots(figsize=(3,5))
for x, y, c in guys2:
x *= .6
plot_args = dict(c=cm(c), mec="b", mfc="w", lw=1, mew=3, ms=10)
plot_guy(x, y, frown(c), **plot_args)
ax.set_frame_on(False)
ax.set_xticks([])
ax.set_yticks([])
fig.tight_layout()
guys2 = [[x,sin(x), x/30.] for x in arange(0,30,1)]
frown = lambda c: c < .2
fig, ax = subplots(figsize=(10,2))
for x, y, c in guys2:
plot_args = dict(c=cm(c), mec="b", mfc="w", lw=1, mew=3, ms=10)
plot_guy(x, y, frown(c), **plot_args)
ax.set_frame_on(False)
ax.set_xticks([])
ax.set_yticks([])
fig.tight_layout()