Question: Need help modifying code for an array! Language:python. Thank you!! Write a code that makes a 2D square array with 20 x 20 elements. Fill

Need help modifying code for an array! Language:python. Thank you!!

Need help modifying code for an array! Language:python. Thank you!! Write a

Write a code that makes a 2D square array with 20 x 20 elements. Fill the array with random numbers initially. Then, "draw" a square in the array by adding a value of 4 to those array elements, and plot it with imshow. The square should be centered and have side lengths of 10. # rows size_1 = 20 # columns size_2 = 20 # fill the2D array with random numbers between @ and 1 data_new = np.random.random((size_1, size_2)) data_new[5:14,5) = 4 data_new[....] = 4 ### data_new[....] = 4 ### data_new[....] = 4 ### # check to see that it worked fig = plt. figure(figsize=(10,10)) plt.imshow(data_new) # play with different colors! # plt. imshow(data_new, cmap='plasma') # plt. imshow(data_new, cmap= 'magma') plt.colorbar()

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!