- 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語言程序設計
- FuelPHP Application Development Blueprints
- Python從小白到大牛
- PHP程序設計(慕課版)
- 我的第一本算法書
- Visual Basic程序設計(第3版):學習指導與練習
- Mastering Articulate Storyline
- C語言程序設計
- Swift 3 New Features
- Mastering JBoss Enterprise Application Platform 7
- Linux Device Drivers Development
- Kotlin從基礎到實戰
- Visual Basic程序設計上機實驗教程
- App Inventor少兒趣味編程動手做
- Python數據預處理技術與實踐