[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnuplot-info
Subject:    RE:
From:       "crawford" <crawford () arete ! com>
Date:       2001-10-30 16:26:39
[Download RAW message or body]

On Tuesday, October 30, 2001 Atef Lotfy  wrote:

>I am a beginner in using GNUplot. I have a text file that consists of 1s
and 0s . I need >to plot it using GNUplot as an x-y graph the time will be
in the x axis and a fixed >duration will be provided for each 1 and 0.

I assume that by "a fixed >duration will be provided for each 1 and 0" you
mean that you want to plot a function like
    duration(i) = 10  if i=0
                = 20  if i=1

You can plot this with a command like
    f(x)= x==0? 10 : 20
    plot "filename" using (f($1))

(You can look up the "ternary operator" used in the definition of f(x) by
"help ternary" and the "plot" command by "help plot".)

This command will use the line number as the x-axis.  If you want to scale
it so that, say, every line corresponds to 5 seconds, then you could use
    plot "filename" using ($0*5):(f($1))

The y-axis will be scaled by default to the range [0:1], so your data will
appear only on the top and bottom axes.  If you want to change that, you can
use a command like "set yrange [0:1.5]".

You can fiddle with lots more things, but I hope this is enough to get you
started.

Dick Crawford, aka crawford@arete.com

 - -
[[[[ to unsubscribe from info-gnuplot, send an email with body
unsubscribe info-gnuplot
to majordomo@dartmouth.edu
]]]]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic