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

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:

主站蜘蛛池模板: 平顺县| 衡山县| 临海市| 丹东市| 昆明市| 德保县| 扶绥县| 古蔺县| 安远县| 德清县| 木兰县| 彩票| 凌云县| 广平县| 五峰| 宁明县| 通河县| 北海市| 安庆市| 昌邑市| 寿阳县| 曲靖市| 吉林省| 绵阳市| 紫阳县| 崇阳县| 韩城市| 卢龙县| 胶南市| 道孚县| 定州市| 根河市| 浦县| 博白县| 扎赉特旗| 荥阳市| 修武县| 武汉市| 凤山县| 新邵县| 蚌埠市|