Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c35781e

Browse files
author
ugurthemaster
committed
Update scatter_demo.py
colors added
1 parent d1cb803 commit c35781e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/shapes_and_collections/scatter_demo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
N = 50
99
x = np.random.rand(N)
1010
y = np.random.rand(N)
11+
colors = np.random.rand(N)
1112
area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radiuses
1213

13-
plt.scatter(x, y, s=area, alpha=0.5)
14+
plt.scatter(x, y, s=area, c=colors, alpha=0.5)
1415
plt.show()

0 commit comments

Comments
 (0)