我正在尝试保存由以下代码生成的数字。我不断收到错误。
x = range(-300,1)
x_2 = range(0,301)
y = range(-300,1)
y_2 = range(0,301)
x_1 = range(-300,1)
y_3 = range(0,-301,-1)
x_3 = range(0,-301,-1)
x_0 = [0 for i in range(301)]
y_0 = [0 for i in range(301)]
plt.plot(x_2,y_2, label="direction 1")
plt.plot(x_2,y_3, label="direction 2")
plt.plot(x_1,y, label="direction 3")
plt.plot(x_3,y_2, label="direction 4")
plt.plot(x_0,y_2, label="direction 5")
plt.plot(x_0,y, label="direction 6")
plt.plot(x_2,y_0, label="direction 7")
plt.plot(x,y_0, label="direction 8")
plt.legend(loc="best")
plt.xlabel("x")
plt.ylabel("y");
我尝试过命名其中一个代码行并保存它,但它说列表没有属性保存fig。所有这些线都应该绘制在一个图中。
守着星空守着你
jeck猫
相关分类