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

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()
主站蜘蛛池模板: 长海县| 河间市| 广河县| 富宁县| 昌都县| 额济纳旗| 永吉县| 顺义区| 温宿县| 长武县| 麟游县| 黄浦区| 永川市| 科技| 高密市| 天峻县| 肥西县| 兴国县| 高要市| 志丹县| 汝阳县| 永吉县| 军事| 中西区| 锡林浩特市| 安阳县| 商洛市| 闵行区| 芮城县| 太原市| 晋州市| 琼结县| 康马县| 凤冈县| 汾西县| 西城区| 永德县| 来安县| 和平县| 冀州市| 丰顺县|