ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Lukáš Procházka" <LPr@pontex.cz>
To: "mailing list for ConTeXt users" <ntg-context@ntg.nl>
Subject: Re: Pgfplots - "reverse legend" by Lua
Date: Thu, 24 Dec 2015 23:01:10 +0100	[thread overview]
Message-ID: <op.x954r8grf14xzu@lkzd-2013> (raw)
In-Reply-To: <5679867D.8020005@wxs.nl>

[-- Attachment #1: Type: text/plain, Size: 1126 bytes --]

Hello,

On Tue, 22 Dec 2015 18:21:01 +0100, Hans Hagen <pragma@wxs.nl> wrote:

>> t = {["legend entries"]="{Cos,Sin2,Sin}", "reverse legend"}
>
> such a table is valid lua (mixture of indexed and hashed) but of course
> the application using it has to know how to use it

OK, so when '{["legend entries"]="{Cos,Sin2,Sin}", "reverse legend"}' is a valid Lua call and, what I guess, a valid Lua-to-context call -
- why the code doesn't work?

I also tried Aditya's way II - to build the "command-string" and to pass it to context:

"
       context(string.format("\\startaxis[legend entries={%s},reverse legend]", "Sin,Cos"))
"

It works, although I'd rather use "context.startaxis{...options...}" style as it looks "nicer".

Next question - why

"
       context[[\startaxis]]
"

doesn't work, whilst

       context"\\startaxis"

does?

(See attached files.)

Best regards,

Lukas

> Hans

-- 
Ing. Lukáš Procházka | mailto:LPr@pontex.cz
Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751
Fax: +420 244 461 038

[-- Attachment #2: t-Plot4.mkiv --]
[-- Type: application/octet-stream, Size: 715 bytes --]

\usemodule[pgfplots]

\starttext
  \starttikzpicture
    \startluacode
      context"\\startaxis" -- OK
    \stopluacode
      \addplot+[green]{sin(deg(x))};
    \stopaxis
  \stoptikzpicture

  \starttikzpicture
    \startluacode
      context(string.format("\\startaxis[legend entries={%s},reverse legend]", "Sin,Cos"))
    \stopluacode
      \addplot+[green]{sin(deg(x))};
      \addplot+[blue]{cos(deg(x))};
    \stopaxis
  \stoptikzpicture

\stoptext % Uncomment here to try the code bellow

  \starttikzpicture
    \startluacode
      context[[\startaxis]] -- Why doesn't work here?
    \stopluacode
      \addplot+[green]{sin(deg(x))};
    \stopaxis
  \stoptikzpicture
\stoptext

[-- Attachment #3: t-Plot4.pdf --]
[-- Type: application/pdf, Size: 14413 bytes --]

[-- Attachment #4: 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
___________________________________________________________________________________

      parent reply	other threads:[~2015-12-24 22:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22  7:52 Procházka Lukáš Ing. - Pontex s. r. o.
2015-12-22 16:36 ` Aditya Mahajan
2015-12-22 17:21   ` Hans Hagen
2015-12-22 22:11     ` Aditya Mahajan
2015-12-24 22:01     ` Lukáš Procházka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.x954r8grf14xzu@lkzd-2013 \
    --to=lpr@pontex.cz \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).