Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2930

Re: Plotting data array as variable (not in files)

X-Received by 10.52.33.104 with SMTP id q8mr27121743vdi.1.1433807490666; Mon, 08 Jun 2015 16:51:30 -0700 (PDT)
X-Received by 10.140.95.135 with SMTP id i7mr231321qge.27.1433807490603; Mon, 08 Jun 2015 16:51:30 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!q107no105369qgd.0!news-out.google.com!k20ni48qgd.0!nntp.google.com!z60no104505qgd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.graphics.apps.gnuplot
Date Mon, 8 Jun 2015 16:51:30 -0700 (PDT)
In-Reply-To <Pine.LNX.4.64.1203131659380.10073@monoceros.physics.muni.cz>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=187.60.94.105; posting-account=4UHz6AoAAAAoKDlyE2KMZafNEcMnpcUk
NNTP-Posting-Host 187.60.94.105
References <5317823c-925c-4d7a-8d21-2fcf7e370a94@th5g2000pbc.googlegroups.com> <Pine.LNX.4.64.1203131659380.10073@monoceros.physics.muni.cz>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <351662c7-ec1c-4e17-b8af-80ca4dd8f9d9@googlegroups.com> (permalink)
Subject Re: Plotting data array as variable (not in files)
From amelco.herman@gmail.com
Injection-Date Mon, 08 Jun 2015 23:51:30 +0000
Content-Type text/plain; charset=ISO-8859-1
X-Received-Bytes 2472
X-Received-Body-CRC 712841682
Xref csiph.com comp.graphics.apps.gnuplot:2930

Show key headers only | View raw


On Tuesday, March 13, 2012 at 1:01:17 PM UTC-3, 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

3 year has been passed and gnuplot still doesn't have arrays. 

This workaround still works and it is awesome!

Back to comp.graphics.apps.gnuplot | Previous | Next | Find similar


Thread

Re: Plotting data array as variable (not in files) amelco.herman@gmail.com - 2015-06-08 16:51 -0700

csiph-web