[prev in list] [next in list] [prev in thread] [next in thread]
List: gnuplot-info
Subject: RE: question on gnuplot....linux 3.7 version
From: "crawford" <crawford () arete ! com>
Date: 2002-08-22 15:46:29
[Download RAW message or body]
On Thursday, August 22, 2002, Sona Prakash wrote:
>I'm a regular gnuplot user and I work with linux, version 3.7.
>I have not been able to find a way to plot a function for only
>part of the xrange. For example, I want to plot a function
>f(x) in the range 0:0.1 and another funcion g(x) only for part
>of that range i.e. for 0:0.05.
>Redefining the plot range doesn't work.
>I also haven't managed to get multiplot to do this.
>Help, please!!!
Include a ternary filter in your function definition. For example,
f(x) = x<1 ? 0/0 : sin(x)
defines f(x) to be sin(x) if x is greater than or equal to 1, and leaves
f(x) undefined (so nothing will be plotted) for x less than 1. (The ternary
syntax is "logical ? do this if true : do this if false".)
So your example might look like this:
f(x) = some function
g(x) = some other function
fp(x) = (x>0 && x<0.1) ? f(x) : 0/0
gp(x) = (x>0 && x<0.05) ? g(x) : 0/0
plot fp(x), gp(x)
Ternary filters can also be put directly into a "using" string on the "plot"
command to plot only a portion of the data. For instance,
plot 'file' using 1:($3>0 ? $2 : 0/0)
will plot column 2 against column 1, but only if column 3 is greater than
zero.
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