- Matplotlib for Python Developers
- Aldrin Yim Claire Chung Allen Yu
- 102字
- 2021-08-27 18:48:20
Scatter plot
Another basic plot type is scatter plot, a plot of dots. You can draw it by calling plt.scatter(x,y). The following example shows a scatter plot of random dots:
import numpy as np
import matplotlib.pyplot as plt
# Set the random seed for NumPy function to keep the results reproducible
np.random.seed(42)
# Generate a 2 by 100 NumPy Array of random decimals between 0 and 1
r = np.random.rand(2,100)
# Plot the x and y coordinates of the random dots on a scatter plot
plt.scatter(r[0],r[1])
# Show the plot
plt.show()
The following plot is the result of the preceding code:

推薦閱讀
- Spring Cloud Alibaba核心技術(shù)與實戰(zhàn)案例
- Python編程自學手冊
- Mastering Python Scripting for System Administrators
- C語言程序設(shè)計
- UI智能化與前端智能化:工程技術(shù)、實現(xiàn)方法與編程思想
- Java Web應(yīng)用開發(fā)技術(shù)與案例教程(第2版)
- 單片機C語言程序設(shè)計實訓(xùn)100例
- Visual Foxpro 9.0數(shù)據(jù)庫程序設(shè)計教程
- Web前端應(yīng)用開發(fā)技術(shù)
- INSTANT Yii 1.1 Application Development Starter
- 快速入門與進階:Creo 4·0全實例精講
- Scala編程(第5版)
- Julia數(shù)據(jù)科學應(yīng)用
- Solr權(quán)威指南(下卷)
- JavaEE架構(gòu)與程序設(shè)計