from numpy import exp, pi, arange import matplotlib.pyplot as plt # Vertices of a hexagon hexa = exp(2j*pi*arange(6)/6) # Vertices of a decagon, shifted and rotated # to have a side perpendicular to the hexagon deca = exp(2j*pi*(0.5+arange(10))/10) deca += hexa[1] - deca[5] # Shift and rotate a pentagon to share one vertex # with the hexagon and one vertex with the decagon omega = exp(2j*pi/5) c = (hexa[2]*omega - deca[4])/(omega - 1) penta = c + (hexa[2] - c)*exp(2j*pi*arange(5)/5) def connect(p, q, c): plt.plot([p.real, q.real], [p.imag, q.imag], '-', color=c) plt.gca().set_aspect("equal") for n in range(-1, 5): connect(hexa[n], hexa[n+1], 'blue') for n in range(-1, 9): connect(deca[n], deca[n+1], 'green') for n in range(-1, 4): connect(penta[n], penta[n+1], 'red') plt.show()