Thanks Jorge
for the helpful and useful instructions. Sometimes it will certainly come in handy.

Jaroslav Hajtmar


Dne 17.2.2014 0:53, DesdeChaves napsal(a):
\usemodule[tikz]
\usemodule[pgfplots]
\usemodule[pgfplotstable]

\starttext

\startluacode

local dados={};

for i=1,10 do
dados[i]=2*i
end

context("\\starttikzpicture")
context("\\pgfplotsset{width=10cm, compat=1.3, legend style={font=\\tfx}}")
    context("\\startaxis[")
    context("xlabel={L  (m) },")
context("ylabel={ $T^2 (s^2)$},legend cell align=left, legend pos=north west]")
    context("\\addplot[only marks] table[row sep=\\\\]{")
     context("X Y\\\\")
for key,value in pairs(dados) do
context("%0.2f %0.1f \\\\", key, value)
end
 context("   };")
    context("\\addlegendentry{Experimental points}")
    context("\\addplot table[row sep=\\\\,")
    context("y={create col/linear regression={y=Y}}]{")
    context("X Y\\\\")
for key,value in pairs(dados) do
context("%0.2f %0.1f \\\\", key, value)
end
    context("};")
    context("\\addlegendentry{")
context("$\\pgfmathprintnumber{\\pgfplotstableregressiona} \\cdot x")
context("\\pgfmathprintnumber[print sign]{\\pgfplotstableregressionb}$ lin. Regression}")
    context("\\stopaxis")
context("\\stoptikzpicture")

\stopluacode


\stoptext

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to