blue = "#4384F9"
grey1 = "#444444"
grey2 = "#EFEFEF"
#Clear axes.
def clearAx(ax):
ax.spines["top"].set_visible(False)
ax.spines["right"].set_visible(False)
ax.spines["bottom"].set_visible(False)
ax.spines["left"].set_visible(False)
ax.set_xticks([])
ax.set_yticks([])
return(ax)
def pin(xy, r) :
return(mpC(xy,
radius = r,
ec = blue,
fc = blue,
lw = 1,
zorder = 2))
def bucket(xw) :
return(mpR((xw[0], 0),
width = xw[1],
height = 425/216,
ec = 'w',
fc = grey1,
lw = 1,
zorder = 2))
def beanBoard(o) :
if o == 'Fiddler':
#Setup.
fig = plt.figure(figsize = (8.25, 6.75))
ax = fig.add_subplot(xlim = (0, 8.25),
ylim = (0, 6.75))
fig.subplots_adjust(left = 0, bottom = 0, right = 1, top = 1)
#Remove axes and ticks.
ax = clearAx(ax)
#Background.
ax.add_patch(mpR((0, 0),
height = 6.75,
width = 8.25,
edgecolor = grey2,
facecolor = grey2,
lw = 1,
zorder = 1))
#Pins.
for xy in [(5/2, 11/4), (23/4, 11/4),
(7/8, 37/8), (33/8, 37/8), (59/8, 37/8),
(5/2, 13/2), (23/4, 13/2)] :
ax.add_patch(pin(xy, 0.2))
#Buckets.
for xw in [(0, 5/2), (5/2, 13/4), (23/4, 5/2)] :
ax.add_patch(bucket(xw))
text = [("A", (5/4, 425/432), 'w', 50),
("B", (33/8, 425/432), 'w', 50),
("C", (7, 425/432), 'w', 50),
("Pa", (7/8, 11/4), 'k', 18),
("Pb", (33/8, 11/4), 'k', 18),
("Pc", (59/8, 11/4), 'k', 18),
("Pl", (5/2, 37/8), 'k', 18),
("Pr", (23/4, 37/8), 'k', 18),
("Pa", (7/8, 13/2), 'k', 18),
("Pb", (33/8, 13/2), 'k', 18),
("Pc", (59/8, 13/2), 'k', 18)]
for t in text :
plt.annotate(text = t[0],
xy = t[1],
c = t[2],
size = t[3],
ha = 'center',
va = 'center',
zorder = 4)
elif o == 'EC':
#Setup.
fig = plt.figure(figsize = (5, 10))
ax = fig.add_subplot(xlim = (0, 5),
ylim = (0, 10))
fig.subplots_adjust(left = 0, bottom = 0, right = 1, top = 1)
#Remove axes and ticks.
ax = clearAx(ax)
#Background.
ax.add_patch(mpR((0, 0),
height = 16.1,
width = 8.25,
edgecolor = grey2,
facecolor = grey2,
lw = 1,
zorder = 1))
xs = [7/20 + 31/40*i for i in range(7)]
ys = [19/2 - 4/5*j for j in range(12)]
#Pins.
for x in [xs[i] for i in [0, 2, 4, 6]] :
for y in [ys[j] for j in [0,2,4,6,8,10]] :
ax.add_patch(pin((x,y), 0.15))
for x in [xs[i] for i in [1, 3, 5]] :
for y in [ys[j] for j in [1, 3, 5, 7, 9, 11]] :
ax.axhline(y = y, xmin = 0, xmax = 5, ls = ':', c = grey1, zorder = 1, lw = 2)
ax.add_patch(pin((x,y), 0.15))
text = [("0", (xs[1], ys[0]+0.15), 10),
("a", (xs[3], ys[0]+0.15), 10),
("-2a+1", (xs[5], ys[0]+0.15), 10),
("0", (xs[0], ys[1]+0.15), 15),
("a/2", (xs[2], ys[1]+0.15), 15),
("(-a+1)/2", (xs[4], ys[1]+0.15), 15),
("a/4", (xs[1], ys[2]+0.15), 10),
("1/4", (xs[3], ys[2]+0.15), 10),
("(-2a+2)/4", (xs[5], ys[2]+0.15), 10),
("a/8", (xs[0], ys[3]+0.15), 15),
("(a+1)/8", (xs[2], ys[3]+0.15), 15),
("(-2a+3)/8", (xs[4], ys[3]+0.15), 15),
("(3a+1)/16", (xs[1], ys[4]+0.15), 9),
("(-a+4)/16", (xs[3], ys[4]+0.15), 9),
("(-4a+6)/16", (xs[5], ys[4]+0.15), 9),
("(3a+1)/32", (xs[0], ys[5]+0.15), 13),
("(2a+5)/32", (xs[2], ys[5]+0.15), 13),
("(-5a+10)/32", (xs[4], ys[5]+0.15), 13),
("(8a+7)/64", (xs[1], ys[6]+0.15), 9),
("(-3a+15)/64", (xs[3], ys[6]+0.15), 9),
("(-10a+20)/64", (xs[5], ys[6]+0.15), 9),
("(8a+7)/128", (xs[0], ys[7]+0.15), 13),
("(5a+22)/128", (xs[2], ys[7]+0.15), 13),
("(-13a+35)/128", (xs[4], ys[7]+0.15), 13),
("(21a+36)/256", (xs[1], ys[8]+0.15), 8),
("(-8a+57)/256", (xs[3], ys[8]+0.15), 8),
("(-26a+70)/256", (xs[5], ys[8]+0.15), 8),
("(21a+36)/512", (xs[0], ys[9]+0.15), 11),
("(13a+93)/512", (xs[2], ys[9]+0.15), 11),
("(-34a+127)/512", (xs[4], ys[9]+0.15), 11),
("(55a+165)/1024", (xs[1], ys[10]+0.15), 8),
("(-21a+220)/1024", (xs[3], ys[10]+0.15), 8),
("(-68a+254)/1024", (xs[5], ys[10]+0.15), 8),
("(55a+165)/2048", (xs[0], ys[11]+0.15), 11),
("(34a+385)/2048", (xs[2], ys[11]+0.15), 11),
("(-89a+474)/2048", (xs[4], ys[11]+0.15), 11)]
for t in text :
plt.annotate(text = t[0],
xy = t[1],
c = grey1,
size = t[2],
ha = 'center',
va = 'center',
zorder = 4)
fig.savefig("2025.01.17" + o + ".png", bbox_inches = "tight")