def plottingElevenMultiples() :
#Plot Setup.
matplotlib.rc_file_defaults()
fig = plt.figure(figsize = (8, 9.4545))
ax = fig.add_subplot(111, xlim = (-1.01, 10.1), ylim = (-1.01, 12.12))
#Remove axes and ticks.
for side in ['bottom', 'left', 'top', 'right']:
ax.spines[side].set_visible(False)
ax.set_xticks([])
ax.set_yticks([])
#Grid lines setup.
for t in range(11):
ax.plot([0, 10], [t, t], c = 'grey', ls = '-', lw = 1)
ax.plot([t, t], [0, 10], c = 'grey', ls = '-', lw = 1)
#Units.
ax.text(4.4, 10.8, "Units Digit", size = 20)
for i in range(10) :
ax.text(i +0.4, 10.1, str(i), size = 20)
#Tens.
ax.text(-1.1, 3.5, "Tens Digit", rotation = "vertical", size = 20)
for i in range(10) :
ax.text(-0.4, 9.3-i, str(i), size = 20)
def animate(i):
plt.title(x = 0.6, y = 0.95, label = "Multiples of 11 from %.0f-%.0f" % (100*i, 100*i+99), fontsize = 22)
def makeRectangle(n, fc) :
x = n % 10
y = 9 - n // 10
ax.add_patch(RE(xy = (x, y),
width = 1,
height = 1,
fc = fc))
#Remove previous hole and multiples.
if i > 0:
makeRectangle(holes[i-1], "white")
for n in multiples[i-1] :
makeRectangle(n, 'white')
#Plot hole.
makeRectangle(9*i, "#481567")
#Plot multiples
for n in multiples[i] :
makeRectangle(n, "#1F968B")
#Run animation, 10 jumps, long pause.
anim = FA(fig = fig,
func = animate,
init_func = None,
frames = 10,
interval = 2000,
blit = False)
anim.save('2022.06.17 Express.mp4');
plottingElevenMultiples()