Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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')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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started