Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9e33f89

Browse filesBrowse files
Eric MaEric Ma
authored andcommitted
mep12 on scatter_masked.py
1 parent f7a5786 commit 9e33f89
Copy full SHA for 9e33f89

File tree

Expand file treeCollapse file tree

1 file changed

+14
-14
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-14
lines changed
+14-14Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
#!/usr/bin/env python
2-
from pylab import *
1+
import matplotlib.pyplot as plt
2+
import numpy as np
33

44
N = 100
55
r0 = 0.6
6-
x = 0.9*rand(N)
7-
y = 0.9*rand(N)
8-
area = pi*(10 * rand(N))**2 # 0 to 10 point radiuses
9-
c = sqrt(area)
10-
r = sqrt(x*x + y*y)
11-
area1 = ma.masked_where(r < r0, area)
12-
area2 = ma.masked_where(r >= r0, area)
13-
scatter(x, y, s=area1, marker='^', c=c, hold='on')
14-
scatter(x, y, s=area2, marker='o', c=c)
6+
x = 0.9*np.random.rand(N)
7+
y = 0.9*np.random.rand(N)
8+
area = np.pi*(10 * np.random.rand(N))**2 # 0 to 10 point radiuses
9+
c = np.sqrt(area)
10+
r = np.sqrt(x*x + y*y)
11+
area1 = np.ma.masked_where(r < r0, area)
12+
area2 = np.ma.masked_where(r >= r0, area)
13+
plt.scatter(x, y, s=area1, marker='^', c=c, hold='on')
14+
plt.scatter(x, y, s=area2, marker='o', c=c)
1515
# Show the boundary between the regions:
16-
theta = arange(0, pi/2, 0.01)
17-
plot(r0*cos(theta), r0*sin(theta))
16+
theta = np.arange(0, np.pi/2, 0.01)
17+
plt.plot(r0*np.cos(theta), r0*np.sin(theta))
1818

19-
show()
19+
plt.show()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.