ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Lua and module gnuplot: Manipulate Gnuplot script with Lua
@ 2011-12-12 21:39 Paul Menzel
  2011-12-12 22:07 ` Mojca Miklavec
  2011-12-12 22:17 ` Hans Hagen
  0 siblings, 2 replies; 11+ messages in thread
From: Paul Menzel @ 2011-12-12 21:39 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1.1: Type: text/plain, Size: 1365 bytes --]

Dear ConTeXt folks,


I have two coefficients saved in a text file

        -0.157737135681261
        -0.211443105668896

and I want to use them to plot a line with gnuplot.

Having several of those files I want to use Lua to create the formula
for the line for me.

I have not yet figured out how to read values from a file in Lua and
just tried to print a constant to the gnuplot command.

I tried the following.

        \usemodule[gnuplot]
        
        \startGNUPLOTscript[lua]
           plot \ctxlua{context(1.2 * x + 3)}
        \stopGNUPLOTscript
        
        \startGNUPLOTscript[nolua]
           plot 1.2 * x + 3
        \stopGNUPLOTscript
        
        \starttext
        \useGNUPLOTgraphic[lua]
        
        Above should be a plot.
        
        \useGNUPLOTgraphic[nolua]
        
        \blank
        \CONTEXT\ \contextmark\ \contextversion
        \stoptext

But only the second plot done and for the first the following error is
shown.

        mtxrun          |
        mtxrun          | executing: gnuplot gnup-gnuplot-1.plt
        mtxrun          |
        mtxrun          |
           plot \ctxlua{context(1.2 * x + 3)}
                ^
        "gnup-gnuplot-1.tmp", line 1: invalid character \

Is there a way to manipulate gnuplot scripts with Lua?


Thanks,

Paul

[-- Attachment #1.1.2: gnup.tex --]
[-- Type: text/x-tex, Size: 336 bytes --]

\usemodule[gnuplot]

\startGNUPLOTscript[lua]
   plot \ctxlua{context(1.2 * x + 3)}
\stopGNUPLOTscript

\startGNUPLOTscript[nolua]
   plot 1.2 * x + 3
\stopGNUPLOTscript

\starttext
\useGNUPLOTgraphic[lua]

Above should be a plot.

\useGNUPLOTgraphic[nolua]

\blank
\CONTEXT\ \contextmark\ \contextversion
\stoptext

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-12-13  9:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-12 21:39 Lua and module gnuplot: Manipulate Gnuplot script with Lua Paul Menzel
2011-12-12 22:07 ` Mojca Miklavec
2011-12-12 22:13   ` Mojca Miklavec
2011-12-12 22:20     ` Hans Hagen
2011-12-12 22:44     ` Paul Menzel
2011-12-12 22:35   ` Paul Menzel
2011-12-13  9:10     ` Hans Hagen
2011-12-13  6:52   ` Aditya Mahajan
2011-12-12 22:17 ` Hans Hagen
2011-12-12 22:27   ` Mojca Miklavec
2011-12-13  6:45     ` Aditya Mahajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).