Question: Using draw squares.py as model, do the following: import numpy as np import matplotlib.pyplot as plt def draw_squares(ax,n,p,w): if n>0: i1 = [1,2,3,0,1] q =

Using draw squares.py as model, do the following:

import numpy as np import matplotlib.pyplot as plt def draw_squares(ax,n,p,w): if n>0: i1 = [1,2,3,0,1] q = p*w + p[i1]*(1-w) ax.plot(p[:,0],p[:,1],color='k') draw_squares(ax,n-1,q,w) plt.close("all") orig_size = 800 p = np.array([[0,0],[0,orig_size],[orig_size,orig_size],[orig_size,0],[0,0]]) fig, ax = plt.subplots() draw_squares(ax,15,p,.8) ax.set_aspect(1.0) ax.axis('off') plt.show() fig.savefig('squares.png') 

Using draw squares.py as model, do the following: import numpy as np

Write a recursive method to draw the following figures: a) b) e) Write a recursive method to draw the following figures: a) b) e)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!