-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotfilter.py
32 lines (23 loc) · 831 Bytes
/
plotfilter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#-----------------------------------------------------------------------
# plotfilter.py
#-----------------------------------------------------------------------
import stdlib.stdio as stdio
import stdlib.stddraw as stddraw
# Read x and y scales from standard input, and configure standard
# draw accordingly. Then read points from standard input until
# end-of-file, and plot them on standard draw.
x0 = stdio.readFloat()
y0 = stdio.readFloat()
x1 = stdio.readFloat()
y1 = stdio.readFloat()
stddraw.setXscale(x0, x1)
stddraw.setYscale(y0, y1)
# Read and plot the points.
stddraw.setPenRadius(0.0)
while not stdio.isEmpty():
x = stdio.readFloat()
y = stdio.readFloat()
stddraw.point(x, y)
stddraw.show()
#-----------------------------------------------------------------------
# python plotfilter.py < usa.txt