[NTG-context] plot data from file: cld
John Kitzmiller
kitz at inradius.net
Sun Jan 4 00:43:29 CET 2015
I seek how to use context-lua to draw a path from ‘points’ in an external file.
Below is one way to plot points from an external file, call the file DATA with contents:
1 3
-2 2
-3 -1
3 -2
\starttext
\startluacode
local metafun = context.metafun
metafun.start()
io.input(“DATA")
while true do
local x, y = io.read("*n", "*n")
if not x then break end
metafun("filldraw fullcircle scaled 2mm shifted(%dcm,%dcm);",x,y)
end
metafun.stop()
\stopluacode
\stoptext
How to make this a polygon?
I know other ways to read and manipulate DATA with Lua—it is the drawing part where I most look for help.
Thanks,
John
More information about the ntg-context
mailing list