首页 > 代码库 > 标准输入到绘图过滤器(plotfilter.py)

标准输入到绘图过滤器(plotfilter.py)

 1 import stddraw
 2 import stdio
 3 # Read and set the x- and y- scales
 4 x0 = stdio.readFloat()
 5 y0 = stdio.readFloat()
 6 x1 = stdio.readFloat()
 7 y1 = stdio.readFloat()
 8 stddraw.setXscale(x0, x1)
 9 stddraw.setYscale(y0, y1)
10 # Read and plot the points
11 stddraw.setPenRadius(0.0)
12 while not stdio.isEmpty():
13     x = stdio.readFloat()
14     y = stdio.readFloat()
15     stddraw.point(x, y)
16 stddraw.show()

技术分享

 

 技术分享

 

标准输入到绘图过滤器(plotfilter.py)