- 单击右方的Jupyter Notebook,稍后在浏览器里会显示Jupyter Notebook的运行环境。
- 在File的第一个下拉菜单“New Notebook” 的右侧箭头处选择“Python 3”,然后会显示一个新的页面
- 把下面的这段python代码拷贝到这个页面“In [ ]:”右侧的空白栏中, 然后单击上方的按键“运行”。
import numpy as np
import matplotlib.pyplot as plt
plt.gca().set_aspect( 1 )
x = np.linspace(start = -5, stop = 5, num = 6)
print(x)
y = -2*x
print(y)
plt.scatter(x, y) # plt.plot(x,y)
plt.show()
import numpy as np
import matplotlib.pyplot as plt
plt.gca().set_aspect( 1 )
x = np.linspace(start = -5, stop = 5, num = 6)
print(x)
y = 2*x
print(y)
plt.scatter(x, y) # plt.plot(x,y)
plt.show()
import numpy as np
import matplotlib.pyplot as plt
plt.gca().set_aspect( 1 )
x = np.linspace(start = -5, stop = 5, num = 6)
print(x)
y = x + 5
print(y)
plt.scatter(x, y) # plt.plot(x,y)
plt.show()
- matplotlib:tutorials
- Pyplot tutorial
- matplotlib.pyplot.gca
- matplotlib.axes.Axes.set_aspect