[NTG-context] plot data from file: cld

Akira Kakuto kakuto at fuk.kindai.ac.jp
Sun Jan 4 06:04:49 CET 2015


Dear John,

> How to make this a polygon?

An example:

\starttext
\startluacode
local metafun = context.metafun
metafun.start()
io.input("DATA")
local i, j
local x, y, s, t1, t2
i = 1
x={}
y={}
s="draw "
while true do
  x[i], y[i] = io.read("*n", "*n")
  if not x[i] then break end
  metafun("filldraw fullcircle scaled 2mm shifted(%dcm,%dcm);",x[i],y[i])
  i = i + 1
end
i = i - 1
for j = 1, i do
  t1 = tostring(x[j])
  t2 = tostring(y[j])
  s = s.."("..t1.."cm,"..t2.."cm)--"
end
t1 = tostring(x[1])
t2 = tostring(y[1])
s = s.."("..t1.."cm,"..t2.."cm)"
s = s.." withpen pencircle scaled 1bp;"
metafun(s)
metafun.stop()
\stopluacode
\stoptext

Best,
Akira



More information about the ntg-context mailing list