From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/86310 Path: news.gmane.org!not-for-mail From: Jaroslav Hajtmar Newsgroups: gmane.comp.tex.context Subject: Re: Pgfplots - passing point coordinates by Lua Date: Mon, 17 Feb 2014 00:00:00 +0100 Message-ID: <530142F0.5040703@gyza.cz> References: Reply-To: hajtmar@gyza.cz, mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; Format="flowed" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1392591645 12133 80.91.229.3 (16 Feb 2014 23:00:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Feb 2014 23:00:45 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Mon Feb 17 00:00:54 2014 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WFAhi-0005Ok-72 for gctc-ntg-context-518@m.gmane.org; Mon, 17 Feb 2014 00:00:54 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 706F9101F3; Mon, 17 Feb 2014 00:00:53 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id nhqw0va4WwHx; Mon, 17 Feb 2014 00:00:51 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 578F2101E6; Mon, 17 Feb 2014 00:00:51 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B806F101E6 for ; Mon, 17 Feb 2014 00:00:49 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ZmPudcJWOfzW for ; Mon, 17 Feb 2014 00:00:47 +0100 (CET) Original-Received: from filter2-til.mf.surf.net (filter2-til.mf.surf.net [194.171.167.218]) by balder.ntg.nl (Postfix) with ESMTP id C9170101E2 for ; Mon, 17 Feb 2014 00:00:38 +0100 (CET) Original-Received: from h1.cmg1.smtp.forpsi.com (h1.cmg1.smtp.forpsi.com [81.2.195.162]) by filter2-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id s1GN0ZNS025820 for ; Mon, 17 Feb 2014 00:00:36 +0100 Original-Received: from [192.168.20.100] ([88.103.230.14]) by cmg1.smtp.forpsi.com with bizsmtp id TB0a1n0070KHK6001B0bUi; Mon, 17 Feb 2014 00:00:35 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 In-Reply-To: X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=81.2.195.162; country=CZ; latitude=49.7500; longitude=15.5000; http://maps.google.com/maps?q=49.7500,15.5000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0TLrb0AKn - 60c302e3ae23 - 20140217 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.218 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:86310 Archived-At: Hi Lukas. A year ago, I tried something similar when I wanted to make an animated = pdf images. With using Lua, I can not handle eventually, but for inspiration attach = a piece of code that demonstrates how get into buffer some parameters = without Lua code. Maybe it inspires you in your solution. I apologize for dirty code, but I cutting it from my old library and my = context application. I did not clean it and I did not translate into = English. For those interested I can possibly do. Jarda Hajtmar Here is my example: \usemodule[tikz] \usemodule[pgfplots] %\define[1]\ListEntry{#1\par} %\processcommalist[one,two,{three,four}]\ListEntry %\processseparatedlist[one*two*three,four][*]\ListEntry \def\zpracujparametry[#1]#2% {\processcommalist[#1]{\nastavparametr{#2}}} % Pou=9Eit=ED: % \zpracujparametry[1,5,3.7,4,5,8,9,11]{ % \getbuffer[funkce1] % \page % } \def\ZPRACUJPARAMETRY#1[#2]#3% {\processseparatedlist[#2][#1]{\nastavparametr{#3}}} % Pou=9Eit=ED: % \ZPRACUJPARAMETRY{znak separ=E1toru}[1,5,3.7,4,5,8,9,11]{ % \getbuffer[funkce1] % \page % } \def\pmparametr#1=3D$#2${\global\def\parametr{#1}\global\def\mparametr{#2}} \def\nastavparametry#1#2{\pmparametr#2\global\def\pparametr{#2}#1}% \def\zpracujdvojparametry[#1]#2% {\processcommalist[#1]{\nastavparametry{#2}}} % Pou=9Eit=ED: % \zpracujdvojparametry[1=3D$a$,5=3D$b$,3.7=3D$c$,4=3D$d$,5=3D$e$,8=3D$f$,9= =3D$g$,11=3D$h$]{ % \getbuffer[funkce1] % \page % } \def\ZPRACUJDVOJPARAMETRY#1[#2]#3% {\processseparatedlist[#2][#1]{\nastavparametry{#3}}} % Pou=9Eit=ED: % = \ZPRACUJDVOJPARAMETRY{;}[1=3D$a$;5=3D$b$;3.7=3D$c$;4=3D$d$;5=3D$e$;8=3D$f$;= 9=3D$g$;11=3D$h$]{ % \getbuffer[funkce1] % \page % } \startbuffer[goniometrickefunkce] \def\function{cos(deg(\x+\parametr))} \def\permfunction{cos(deg(\x))} \def\permfunctiontwo{sin(deg(\x))} \startTEXpage \starttikzpicture[scale=3D1] \tikzset{style=3D{font=3D\ssxx}} \startaxis [xmin=3D-1.6, xmax=3D10, domain=3D-1.6:10, ymin=3D-1.1, ymax=3D1.1, width=3D\textwidth, height=3D0.3\textwidth, axis x line=3Dmiddle, axis y line=3Dmiddle, axis equal=3Dtrue, xlabel=3D$x$, ylabel=3D$y$, samples=3D600, clip=3Dtrue, xtick=3D{0}, ytick=3D{-1,0,1}, grid=3Dmajor, extra x ticks=3D{-1.57,1.57,3.14,4.71,6.28,7.85,9.42,10.99,12.57}, extra x = tick = labels=3D{$-\frac{\pi}{2}$,$\frac{\pi}{2}$,$\pi$,$3\!\frac{\pi}{2}$,$2\pi$,= $5\!\frac{\pi}{2}$,$3\pi$}, title=3D{{\framed[frame=3Doff,height=3D1cm]{\blue $\ssb f\!:\ y=3D\cos{(x = \mparametr )}$}}}, ] \addplot[color=3Dyellow, line width=3D0.5pt] {\permfunctiontwo}; \addplot[color=3Dred, line width=3D0.5pt] {\permfunction}; \addplot[color=3Dblue, line width=3D1pt] {\function}; \stopaxis \stoptikzpicture \stopTEXpage \stopbuffer \starttext \ZPRACUJDVOJPARAMETRY{*}[1.57=3D$+\frac{\pi}{2}$*1.047=3D$+\frac{\pi}{3}$*0= .785=3D$+\frac{\pi}{4}$*0.524=3D$+\frac{\pi}{6}$*0=3D$-0$*-0.524=3D$-\frac{= \pi}{6}$*-0.785=3D$-\frac{\pi}{4}$*-1.047=3D$-\frac{\pi}{3}$*-1.57=3D$-\fra= c{\pi}{2}$*-3.142=3D$-\pi$*-4.712=3D$-\frac{3\pi}{2}$*6.28=3D$-2\pi$]{ \getbuffer[goniometrickefunkce] \page } \stoptext Dne 15.2.2014 20:38, Luk=E1=9A Proch=E1zka napsal(a): > 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 =3D {{5, 15}, {20, 20}, {24, -24}} > > plot =3D function(data) > local str > > for i, v in ipairs(data) do > str =3D (str or "") .. "(" .. v[1] .. "," .. v[2] .. ")" > end > > print("Crds=3D", str) > > context(str) > end > \stopluacode > > \starttext > \starttikzpicture > \startaxis[] > \addplot[mark=3Dnone,color=3Dred] coordinates {(11, 5) (12, 18)}; % THIS = > PLOT IS OK > \addplot[mark=3Dnone,color=3Dred] coordinates {\ctxlua{plot(data)}}; % = > THIS PLOT HAS NO POINT (?!) > \stopaxis > \stoptikzpicture > \stoptext > ---- > > gives error: > > " > ... > fonts > fallback modern rm 12pt is loaded > Crds=3D (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 > > > > > _________________________________________________________________________= __________ > 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-co= ntext > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > _________________________________________________________________________= __________ ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________