Received: by 10.224.220.12 with SMTP id hw12mr6642183qab.8.1349405759556; Thu, 04 Oct 2012 19:55:59 -0700 (PDT) Received: by 10.52.96.71 with SMTP id dq7mr1563174vdb.11.1349405759522; Thu, 04 Oct 2012 19:55:59 -0700 (PDT) Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!l8no25892683qao.0!news-out.google.com!e10ni165558057qan.0!nntp.google.com!l8no25892677qao.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.graphics.apps.gnuplot Date: Thu, 4 Oct 2012 19:55:59 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=99.172.17.119; posting-account=xPraKwoAAACuhP2AaEPZD9ou4bAXJDMz NNTP-Posting-Host: 99.172.17.119 References: <5317823c-925c-4d7a-8d21-2fcf7e370a94@th5g2000pbc.googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <2373d8f7-3ffb-429f-bf95-519c2278e735@googlegroups.com> Subject: Re: Plotting data array as variable (not in files) From: Kevin Cc: MamboKnave Injection-Date: Fri, 05 Oct 2012 02:55:59 +0000 Content-Type: text/plain; charset=ISO-8859-1 Lines: 69 Xref: csiph.com comp.graphics.apps.gnuplot:1398 On Tuesday, March 13, 2012 12:01:17 PM UTC-4, Petr Mikulik wrote: > > I have hard time to understand how I can do the following. > > > > > > I'm starting gnuplot with an input command file: > > > > > > gnuplot -persist < inputFile.gpl > > > > > > Within the inputFile.gpl I want to have two arrays X and Y as gnuplot > > > variables. For instance: > > > > > > Y = [0.8117, 0.944, 0.9937, 1.0145, 0.9369, 0.9574, 0.9861, 0.9484, > > > 0.9891, 0.9987, 1.0485, 0.6612, 0.6899, 0.87] > > > X = [817, 818, 819, 822, 823, 824, 825, 826, 829, 830, 831, 901, 902, > > > 906] > > > > > > I need gnuplot to plot Y(X) but I do not know how to set these arrays > > > as variables within the command file inputFile.gpl > > > > > > Basically, the two data arrays X, Y are not stored in external files. > > > They are variables within the inputFile.gpl and gnuplot should plot > > > Y(X) > > > > > > Can someone please give me a hint? > > > > It's a strange data set-up, but try this: > > > > X="0.1 0.2 0.3 0.4 0.5" > > Y="-1 0 2 4 8" > > > > set parametric > > set trange [1:words(X)]; set samples words(X) > > plot (0+word(X,int(t))),(0+word(Y,int(t))) > > > > --- > > PM This is a brilliant workaround for gnuplot not having arrays. This snippet should be part of every gnuplot tutorial in christendom.