官术网_书友最值得收藏!

Plotting a curve

Plotting a line graph of the list can be as simple as:

plt.plot(evens)

When only one parameter is specified, Pyplot assumes the data we input is on the y axis and chooses a scale for the x axis automatically.

To plot a graph, call plt.plot(x,y) where x and y are the x coordinates and y coordinates of data points:

plt.plot(evens,evens**2)

To label the curve with a legend, we add the label information in the plot function:

plt.plot(evens,evens**2,label = 'x^2')
plt.legend()
主站蜘蛛池模板: 中牟县| 河池市| 济宁市| 北川| 资兴市| 黄梅县| 锡林浩特市| 肇庆市| 衢州市| 崇文区| 西乡县| 门头沟区| 临澧县| 太原市| 陆良县| 青浦区| 巴中市| 乾安县| 安龙县| 金溪县| 三都| 奉贤区| 兴安县| 阿城市| 孟连| 如东县| 浠水县| 贵港市| 赤壁市| 铜川市| 疏勒县| 佛学| 布尔津县| 巴马| 普陀区| 二连浩特市| 吉林省| 泽普县| 汉川市| 郎溪县| 平阴县|