到目前为止,在我的代码中,我有:
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
# DATA
L = 0.1 #m, length of arm of cross
t = L/2 #m, thickness
# VECTORS OF COORDINATES OF THE CROSS
X = np.array([L, t/2, t/2, -t/2, -t/2, -L, -L, -t/2, -t/2, t/2, t/2, L, L])
Y = np.array([t/2, t/2, L, L, t/2, t/2, -t/2, -t/2, -L, -L, -t/2, -t/2, t/2])
# PLOT
fig, ax = plt.subplots(figsize=(8,8))
ax.plot(X,Y,color='C1', linewidth=2.5)
ax.axis('equal')
circle2 = plt.Circle((L - t/2, 0), t/4, color='b', fill=False)
ax.add_patch(circle2)
我希望在十字架上再加上四个相同的圆圈,一个在两端,一个在中间。我可以用python来做这个吗? 我尝试使用相同的圆2代码,不同的名称,如circle3、circle4等,并更改坐标,但它说找不到圆的名称
如果我没弄错你的问题,这似乎有效
你说的很好,也许你做错了什么,打字错误。这是我试过的代码
相关问题 更多 >
编程相关推荐