From: "Lukáš Procházka" <LPr@pontex.cz>
To: ConTeXt <ntg-context@ntg.nl>
Subject: Pgfplots - passing point coordinates by Lua
Date: Sat, 15 Feb 2014 20:38:49 +0100 [thread overview]
Message-ID: <op.xbb8uzjef14xzu@lkzd-2013> (raw)
[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]
Hello,
I just started experimenting with pgfplots package.
I'd have two questions:
1) When plotting/loading a data file: Is it possible to specify the comment mark, which is '#' and '%" by default? I'd need to treat ';' as a comment mark, too.
2) How to pass coordinates of plot points by Lua?
The following code:
----
\usemodule[tikz]
\usemodule[pgfplots]
\startluacode
data = {{5, 15}, {20, 20}, {24, -24}}
plot = function(data)
local str
for i, v in ipairs(data) do
str = (str or "") .. "(" .. v[1] .. "," .. v[2] .. ")"
end
print("Crds=", str)
context(str)
end
\stopluacode
\starttext
\starttikzpicture
\startaxis[]
\addplot[mark=none,color=red] coordinates {(11, 5) (12, 18)}; % THIS PLOT IS OK
\addplot[mark=none,color=red] coordinates {\ctxlua{plot(data)}}; % THIS PLOT HAS NO POINT (?!)
\stopaxis
\stoptikzpicture
\stoptext
----
gives error:
"
...
fonts > fallback modern rm 12pt is loaded
Crds= (5,15)(20,20)(24,-24)
Package pgfplots: Error! Sorry, I could not read the plot coordinates near '(5,15)(20,20)(24,-24)'. Please check for format mistakes.
! Package pgfplots Warning: the current plot has no coordinates (or all have been filtered away)...
"
Any idea from someone more familiar with pgfplots would be appreciated.
TIA.
Best regards,
Lukas
--
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-Plot2.mkiv --]
[-- Type: application/octet-stream, Size: 550 bytes --]
\usemodule[tikz]
\usemodule[pgfplots]
\startluacode
data = {{5, 15}, {20, 20}, {24, -24}}
plot = function(data)
local str
for i, v in ipairs(data) do
str = (str or "") .. "(" .. v[1] .. "," .. v[2] .. ")"
end
print("Crds=", str)
context(str)
end
\stopluacode
\starttext
\starttikzpicture
\startaxis[]
\addplot[mark=none,color=red] coordinates {(11, 5) (12, 18)};
\addplot[mark=none,color=red] coordinates {\ctxlua{plot(data)}};
\stopaxis
\stoptikzpicture
\stoptext
[-- Attachment #3: t-Plot2.pdf --]
[-- Type: application/pdf, Size: 7571 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
___________________________________________________________________________________
next reply other threads:[~2014-02-15 19:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-15 19:38 Lukáš Procházka [this message]
2014-02-16 19:32 ` Herbert Voss
2014-02-16 20:39 ` Lukáš Procházka
2014-02-16 21:56 ` Herbert Voss
2014-02-16 23:00 ` Jaroslav Hajtmar
2014-02-16 23:53 ` DesdeChaves
2014-02-17 0:11 ` Jaroslav Hajtmar
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.xbb8uzjef14xzu@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).