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


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

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

Newsgroups comp.graphics.apps.gnuplot
Date 2015-10-22 03:09 -0700
References <5317823c-925c-4d7a-8d21-2fcf7e370a94@th5g2000pbc.googlegroups.com> <Pine.LNX.4.64.1203131659380.10073@monoceros.physics.muni.cz>
Message-ID <f8e235e0-8152-43c2-a9ba-7b02bed0796d@googlegroups.com> (permalink)
Subject Re: Plotting data array as variable (not in files)
From HALSA <sara.hallouda@googlemail.com>

Show all headers | View raw


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

Extremely useful trick:)

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


Thread

Plotting data array as variable (not in files) MamboKnave <mamboknave@gmail.com> - 2012-03-07 11:57 -0800
  Re: Plotting data array as variable (not in files) Péter Juhász <peter.juhasz83@gmail.com> - 2012-03-08 11:13 -0800
  Re: Plotting data array as variable (not in files) Petr Mikulik <mikulik@physics.muni.cz> - 2012-03-13 16:01 +0000
    Re: Plotting data array as variable (not in files) MamboKnave <mamboknave@gmail.com> - 2012-03-14 14:06 -0700
    Re: Plotting data array as variable (not in files) Kevin <kevin.nielson@gmail.com> - 2012-10-04 19:55 -0700
    Re: Plotting data array as variable (not in files) amelco.herman@gmail.com - 2015-06-08 16:51 -0700
    Re: Plotting data array as variable (not in files) HALSA <sara.hallouda@googlemail.com> - 2015-10-22 03:09 -0700
    Re: Plotting data array as variable (not in files) xlrotor@gmail.com - 2016-09-06 14:11 -0700
      Re: Plotting data array as variable (not in files) Ethan A Merritt <sfeam@users.sourceforge.net> - 2016-09-06 15:22 -0700
        Re: Plotting data array as variable (not in files) xlrotor@gmail.com - 2016-09-07 12:33 -0700

csiph-web