File:PythonAdoExamole01.png
Jump to navigation
Jump to search
Size of this preview: 799 × 329 pixels. Other resolutions: 320 × 132 pixels | 1,020 × 420 pixels.
Original file (1,020 × 420 pixels, file size: 7 KB, MIME type: image/png)
Summary
Example of use of Python routine Ado.py
Generator
import math o= open("PythonAdoExamole01.eps","w+") def ado(x,y): o.write("%!PS-Adobe-2.0 EPSF-2.0\r\n%%") o.write("BoundingBox: 0 0 %d " %x) o.write("%d\r\n" %y) o.write("/RGB {setrgbcolor} bind def\r\n") o.write("/W {setlinewidth} bind def\r\n") o.write("/M {moveto} bind def\r\n") o.write("/L {lineto} bind def\r\n") o.write("/C {closepath} bind def\r\n") o.write("/S {stroke} bind def\r\n") ado(1020,420) o.write("10 10 translate\r\n") o.write("100 100 scale\r\n") o.write("1 setlinejoin 2 setlinecap\r\n") def M(x,y): o.write("%f " %x) o.write("%f M\n" %y) def L(x,y): o.write("%f " %x) o.write("%f L\n" %y) for n in range(0,5): M(0, n) L(10, n) for n in range(0,11): M(n,4) L(n,0) o.write("0 0 0 RGB .02 W S\r\n") a = [3.190074, 3.00812328, 2.81343466, 2.60300605, 2.37695838, 2.1300704, 1.86308525, 1.57027974, 1.24972556, 0.89783445, 0.50733685] for n in range(0,11): print n, a[n] M(0,a[0]) for n in range(1,11): # x= math.sin(.1*n) L(n,a[n]) o.write("1 0 0 RGB .1 W S\r\n") o.write("showpage\r\n") o.close() print("closed\n") import os os.system("epstopdf PythonAdoExamole01.eps") os.system(" xpdf PythonAdoExamole01.pdf")
Notes
For some operational systems, command «xpdf» in the last line of the code may have need to be replaced to «display».
For portability, the result is transformed with command
convert PythonAdoExamole01.eps png8:PythonAdoExamole01.png
References
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 06:03, 2 December 2024 | 1,020 × 420 (7 KB) | T (talk | contribs) | == Summary == {{oP}} Example of use of Python routine Ado.py ==Generator== <pre> import math o= open("PythonAdoExamole01.eps","w+") def ado(x,y): o.write("%!PS-Adobe-2.0 EPSF-2.0\r\n%%") o.write("BoundingBox: 0 0 %d " %x) o.write("%d\r\n" %y) o.write("/RGB {setrgbcolor} bind def\r\n") o.write("/W {setlinewidth} bind def\r\n") o.write("/M {moveto} bind def\r\n") o.write("/L {lineto} bind def\r\n") o.write("/C {closepath} bind def\r\n") o.write("/S {stroke} bind def\r\n")... |
You cannot overwrite this file.
File usage
There are no pages that use this file.