- Matplotlib 2.x By Example
- Allen Yu Claire Chung Aldrin Yim
- 83字
- 2021-07-02 19:34:34
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()
推薦閱讀
- Java語言程序設計
- Mastering Entity Framework Core 2.0
- Cocos2D-X權威指南(第2版)
- Docker and Kubernetes for Java Developers
- C語言程序設計案例教程(第2版)
- 深入理解Django:框架內幕與實現原理
- Learning C++ Functional Programming
- Reactive Programming with Swift
- R語言游戲數據分析與挖掘
- Quarkus實踐指南:構建新一代的Kubernetes原生Java微服務
- 程序員修煉之道:通向務實的最高境界(第2版)
- SQL Server 2016數據庫應用與開發
- Protocol-Oriented Programming with Swift
- 搞定J2EE:Struts+Spring+Hibernate整合詳解與典型案例
- Java Web應用開發給力起飛