python怎么实现画圆功能

2025-01-29 14:12:04
推荐回答(1个)
回答1:

你可以用下面的库:import numpy as npimport matplotlib.pyplot as plt fig = plt.figure(figsize=(8,8))ax = fig.add_subplot("11")
theta = np.arange(0, 2 * np.pi + 0.1,2 * np.pi / 1000)x = np.cos(theta)y = np.sin(theta) v = np.linspace(0, 10, 100)v.shape = (100, 1) x = v * xy = v * y plt.plot(x, y, color='pink')# plt.savefig('ball1.jpg')plt.show()