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

* Re: Lua and module gnuplot: Manipulate Gnuplot script with Lua
  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
                     ` (2 more replies)
  2011-12-12 22:17 ` Hans Hagen
  1 sibling, 3 replies; 11+ messages in thread
From: Mojca Miklavec @ 2011-12-12 22:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, Dec 12, 2011 at 22:39, Paul Menzel wrote:
> 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

This won't work. The reason is that contents between
\startGNUPLOTscript and \stopGNUPLOTscript are not parsed by ConTeXt
on purpose.

It was very very very painful if not impossible to get it right with
parsing. I often do things like
    \def\E#1{$10^{#1}$}

    \startGNUPLOTscript[name]
    set logscale y
    set format y "\\E{%T}"
    plot sin(x) t '$\sin(x) [\E{3}]$' # usually something else with
logscale, but just to show the point
    \stopGNUPLOTscript

and if ConTeXt starts parsing this it becomes a pure nightmare.
Realize that it can easily happen that ConTeXt then writes out
    set logscale y
    set format y "<some junk leftovers from \\>
    E<ungrouped { since % starts comment>
    plot sin(x) t '\math{\mathrm{sin}(x) [{10^{3}}]}' <arbitrary junk
from expansion ...>



However, \startGNUPLOTinclusions is parsed and you could in theory
misuse that, but it would be very bad coding practice.

It would be a lot better to come up with some proposal how to change
the interface to enable what you want to do. (To be honest, it is
still on my todo list to migrate to Aditya's filter module in the
background, but I don't find the courage to start since I have no idea
how many bugs will creep in.)

But a serious question: what *exactly* do you want to do with lua that
you are unable to do with some (even though ugly) gnuplot trickery?
Gnuplot does have some basic programmable capabilities. I can imagine
that you should be able to do something like:

# params.dat
a=-0.157737135681261
b=-0.211443105668896

\startGNUPLOTinclusions
f(x,a,b)=a*x+b
\stopGNUPLOTinclusions

\startGNUPLOTscript[name]
load 'params.dat'
plot f(x,a,b)
\stopGNUPLOTscript

And if needed you can create params.dat on the fly (but I believe that
the same should be doable even if you start with just pure data values
and do some dirty tricks in gnuplot).

Yet another trick could be to create a text file on the fly with lua
(if you really really really need that) and then your script only says
something like.

# bla.plt created on the fly with lua scripts
plot 1.2 * x + 3

\startGNUPLOTscript[bla]
load 'bla.plt'
\stopGNUPLOTscript

I leave creating a suitable 'bla.plt' with lua to others ...

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

* Re: Lua and module gnuplot: Manipulate Gnuplot script with Lua
  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  6:52   ` Aditya Mahajan
  2 siblings, 2 replies; 11+ messages in thread
From: Mojca Miklavec @ 2011-12-12 22:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, Dec 12, 2011 at 23:07, Mojca Miklavec wrote:
>
> However, \startGNUPLOTinclusions is parsed and you could in theory
> misuse that, but it would be very bad coding practice.

(Wait, I'm not sure about that. I think that I fixed that for the same
reason, but I need to check.)

Either way the moral of the story is still the same: context parsing
is very very very confusing and you don't want to go there. In
particular you never know if something should be parsed and executed
before or after gnuplot processing.

One more example. One thing that would most probably work (I didn't
try it) would be the following:

\startGNUPLOTscript[name]
plot sin(x) t '$\pi = \ctxlua{math.pi()}$'
\stopGNUPLOTscript

How can you explain to ConTeXt whether lua command has to be executed
before or after gnuplot does its job? (label width will be wrong in
either case, but that's not the point)

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

* Re: Lua and module gnuplot: Manipulate Gnuplot script with Lua
  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:17 ` Hans Hagen
  2011-12-12 22:27   ` Mojca Miklavec
  1 sibling, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2011-12-12 22:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Paul Menzel

On 12-12-2011 22:39, Paul Menzel wrote:
> 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

You have to twist your mide a bit:

\startluacode
   local x = 10
   context.startGNUPLOTscript{ "lua" }
   context("plot %s",1.2 * x + 3)
   context.stopGNUPLOTscript()
\stopluacode


\starttext
\useGNUPLOTgraphic[lua]
\stoptext





-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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

* Re: Lua and module gnuplot: Manipulate Gnuplot script with Lua
  2011-12-12 22:13   ` Mojca Miklavec
@ 2011-12-12 22:20     ` Hans Hagen
  2011-12-12 22:44     ` Paul Menzel
  1 sibling, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2011-12-12 22:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Mojca Miklavec

On 12-12-2011 23:13, Mojca Miklavec wrote:

> Either way the moral of the story is still the same: context parsing
> is very very very confusing and you don't want to go there. In
> particular you never know if something should be parsed and executed
> before or after gnuplot processing.

Actually this kind of parsing is rather predictable: you use a buffer, 
so no parsing takes place. On the other hand, the mp environments are 
passed directly and therefore the content is expanded, unless a macro is 
defined as unexpandable (which many macros are).

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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

* Re: Lua and module gnuplot: Manipulate Gnuplot script with Lua
  2011-12-12 22:17 ` Hans Hagen
@ 2011-12-12 22:27   ` Mojca Miklavec
  2011-12-13  6:45     ` Aditya Mahajan
  0 siblings, 1 reply; 11+ messages in thread
From: Mojca Miklavec @ 2011-12-12 22:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, Dec 12, 2011 at 23:17, Hans Hagen wrote:
>
> You have to twist your mide a bit:
>
> \startluacode
>  local x = 10
>  context.startGNUPLOTscript{ "lua" }
>  context("plot %s",1.2 * x + 3)
>  context.stopGNUPLOTscript()
> \stopluacode
>
>
> \starttext
> \useGNUPLOTgraphic[lua]
> \stoptext

Oh, I like this one!

Not that it works at the moment, but fixing the module to make it work
is doable (which is not to say that I know how to do it).

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

* Re: Lua and module gnuplot: Manipulate Gnuplot script with Lua
  2011-12-12 22:07 ` Mojca Miklavec
  2011-12-12 22:13   ` Mojca Miklavec
@ 2011-12-12 22:35   ` Paul Menzel
  2011-12-13  9:10     ` Hans Hagen
  2011-12-13  6:52   ` Aditya Mahajan
  2 siblings, 1 reply; 11+ messages in thread
From: Paul Menzel @ 2011-12-12 22:35 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 4430 bytes --]

Am Montag, den 12.12.2011, 23:07 +0100 schrieb Mojca Miklavec:
> On Mon, Dec 12, 2011 at 22:39, Paul Menzel wrote:

> > 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
> 
> This won't work. The reason is that contents between
> \startGNUPLOTscript and \stopGNUPLOTscript are not parsed by ConTeXt
> on purpose.
> 
> It was very very very painful if not impossible to get it right with
> parsing. I often do things like
>     \def\E#1{$10^{#1}$}
> 
>     \startGNUPLOTscript[name]
>     set logscale y
>     set format y "\\E{%T}"
>     plot sin(x) t '$\sin(x) [\E{3}]$' # usually something else with
> logscale, but just to show the point
>     \stopGNUPLOTscript
> 
> and if ConTeXt starts parsing this it becomes a pure nightmare.
> Realize that it can easily happen that ConTeXt then writes out
>     set logscale y
>     set format y "<some junk leftovers from \\>
>     E<ungrouped { since % starts comment>
>     plot sin(x) t '\math{\mathrm{sin}(x) [{10^{3}}]}' <arbitrary junk
> from expansion ...>
> 
> 
> 
> However, \startGNUPLOTinclusions is parsed and you could in theory
> misuse that, but it would be very bad coding practice.

Thank you very much for your explanations.

> It would be a lot better to come up with some proposal how to change
> the interface to enable what you want to do. (To be honest, it is
> still on my todo list to migrate to Aditya's filter module in the
> background, but I don't find the courage to start since I have no idea
> how many bugs will creep in.)

I do not know this very well, so I do not know what would change when
using the filter module. I guess in the end being able to pass a
plt-file to `\startGNUPLOTscript` would be enough.

> But a serious question: what *exactly* do you want to do with lua that
> you are unable to do with some (even though ugly) gnuplot trickery?

I do not know. This was just a product out of my ignorance. Searching
for `gnuplot load parameters` or something like that only turned `fit`
related stuff.

Thinking about this, I should have searched harder or looked at the
manual or examples.

> Gnuplot does have some basic programmable capabilities. I can imagine
> that you should be able to do something like:
> 
> # params.dat
> a=-0.157737135681261
> b=-0.211443105668896
> 
> \startGNUPLOTinclusions
> f(x,a,b)=a*x+b
> \stopGNUPLOTinclusions
> 
> \startGNUPLOTscript[name]
> load 'params.dat'
> plot f(x,a,b)
> \stopGNUPLOTscript
>
> And if needed you can create params.dat on the fly (but I believe that
> the same should be doable even if you start with just pure data values
> and do some dirty tricks in gnuplot).

That pretty much what I need. Thank you!

What I do is to do simulations and then do the linear regression using R
[1]. (I know gnuplot can do that too, but I got some errors with it and
using R seems easier for me.) Then the calculated coefficient are saved
to a separate file because having discovered your nice gnuplot module I
want to use that for plotting. Now I need to read in those parameters. I
guess I have to compose the plot manually but those parameters were
essential.

> Yet another trick could be to create a text file on the fly with lua
> (if you really really really need that) and then your script only says
> something like.
> 
> # bla.plt created on the fly with lua scripts
> plot 1.2 * x + 3
> 
> \startGNUPLOTscript[bla]
> load 'bla.plt'
> \stopGNUPLOTscript
> 
> I leave creating a suitable 'bla.plt' with lua to others ...

That is in my opinion the best solution. If I want to script something
there are enough solutions already. Being able to use the tools of once
choice and to insert the result should fit everyone’s need.

Thank you again very much for your help.


Thanks,

Paul


[1] http://www.r-project.org/

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

* Re: Lua and module gnuplot: Manipulate Gnuplot script with Lua
  2011-12-12 22:13   ` Mojca Miklavec
  2011-12-12 22:20     ` Hans Hagen
@ 2011-12-12 22:44     ` Paul Menzel
  1 sibling, 0 replies; 11+ messages in thread
From: Paul Menzel @ 2011-12-12 22:44 UTC (permalink / raw)
  To: ntg-context


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

Am Montag, den 12.12.2011, 23:13 +0100 schrieb Mojca Miklavec:

[…]

> One more example. One thing that would most probably work (I didn't
> try it) would be the following:
> 
> \startGNUPLOTscript[name]
> plot sin(x) t '$\pi = \ctxlua{math.pi()}$'
> \stopGNUPLOTscript

It has some syntax errors, but that is what I tried first and it worked
great. Here is a full example.

        \usemodule[gnuplot]
        
        \startGNUPLOTscript[pi]
        plot pi t '$π = \ctxlua{context(math.pi)}$'
        \stopGNUPLOTscript
        
        \starttext
        \useGNUPLOTgraphic[pi]
        
        \blank
        \CONTEXT\ \contextmark\ \contextversion
        \stoptext


Thanks,

Paul

[-- Attachment #1.1.2: gnup.pdf --]
[-- Type: application/pdf, Size: 15206 bytes --]

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

\usemodule[gnuplot]

\startGNUPLOTscript[pi]
plot pi t '$π = \ctxlua{context(math.pi)}$'
\stopGNUPLOTscript

\starttext
\useGNUPLOTgraphic[pi]

\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

* Re: Lua and module gnuplot: Manipulate Gnuplot script with Lua
  2011-12-12 22:27   ` Mojca Miklavec
@ 2011-12-13  6:45     ` Aditya Mahajan
  0 siblings, 0 replies; 11+ messages in thread
From: Aditya Mahajan @ 2011-12-13  6:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 736 bytes --]

On Mon, 12 Dec 2011, Mojca Miklavec wrote:

> On Mon, Dec 12, 2011 at 23:17, Hans Hagen wrote:
>>
>> You have to twist your mide a bit:
>>
>> \startluacode
>>  local x = 10
>>  context.startGNUPLOTscript{ "lua" }
>>  context("plot %s",1.2 * x + 3)
>>  context.stopGNUPLOTscript()
>> \stopluacode
>>
>>
>> \starttext
>> \useGNUPLOTgraphic[lua]
>> \stoptext
>
> Oh, I like this one!
>
> Not that it works at the moment, but fixing the module to make it work
> is doable (which is not to say that I know how to do it).

I have not looked into the internals of gnuplot in a while, but

context("\\startGNUplotscript[lua]")
context("plot %s", 1.2*x + 3)
context("\\stopGNUplotscript")

should work.

Aditya

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

* Re: Lua and module gnuplot: Manipulate Gnuplot script with Lua
  2011-12-12 22:07 ` Mojca Miklavec
  2011-12-12 22:13   ` Mojca Miklavec
  2011-12-12 22:35   ` Paul Menzel
@ 2011-12-13  6:52   ` Aditya Mahajan
  2 siblings, 0 replies; 11+ messages in thread
From: Aditya Mahajan @ 2011-12-13  6:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, 12 Dec 2011, Mojca Miklavec wrote:

> It would be a lot better to come up with some proposal how to change
> the interface to enable what you want to do. (To be honest, it is
> still on my todo list to migrate to Aditya's filter module in the
> background, but I don't find the courage to start since I have no idea
> how many bugs will creep in.)

Hey, there are no bugs in the filter module ;) If you can send me a 
complete behavioral description of what the gnuplot module does (what 
should be written to gnuplot file, what exact command should be called, 
etc), then I could easily write a wrapper based on the filter module.

But the filter module will not help with the OP's question, as the content 
I treat the filter environment as a buffer and don't parse it at all.

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

* Re: Lua and module gnuplot: Manipulate Gnuplot script with Lua
  2011-12-12 22:35   ` Paul Menzel
@ 2011-12-13  9:10     ` Hans Hagen
  0 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2011-12-13  9:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Paul Menzel

On 12-12-2011 23:35, Paul Menzel wrote:

>>      \def\E#1{$10^{#1}$}

\unexpanded\def\E....

>>      \startGNUPLOTscript[name]
>>      set logscale y
>>      set format y "\\E{%T}"
>>      plot sin(x) t '$\sin(x) [\E{3}]$' # usually something else with
>> logscale, but just to show the point
>>      \stopGNUPLOTscript
>>
>> and if ConTeXt starts parsing this it becomes a pure nightmare.

well, this is how a macro language works ...


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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).