We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 64dda97 commit 6450df6Copy full SHA for 6450df6
1 file changed
blog34-based-opencv/blog34_05.py
@@ -0,0 +1,30 @@
1
+# coding: utf-8
2
+import numpy as np
3
+import matplotlib.pyplot as plt
4
+
5
+#生成随机数表示点的坐标
6
+x = np.random.randn(200)
7
+y = np.random.randn(200)
8
9
+#生成随机点的大小及颜色
10
+size = 50*np.random.randn(200)
11
+colors = np.random.rand(200)
12
13
+#用来正常显示中文标签
14
+plt.rc('font', family='SimHei', size=13)
15
16
+#用来正常显示负号
17
+plt.rcParams['axes.unicode_minus'] = False
18
19
+#绘制散点图
20
+plt.scatter(x, y, s=size, c=colors)
21
22
+#设置x、y轴名称
23
+plt.xlabel(u"x坐标")
24
+plt.ylabel(u"y坐标")
25
26
+#绘制标题
27
+plt.title(u"Matplotlib绘制散点图")
28
29
+#显示图像
30
+plt.show()
0 commit comments